code: def test_cache_retrieves_item():
      my_cache = cache.LRUCache[int, Union[int, str]](
          max_cache_items=10,
          expiration_horizon=datetime.timedelta(hours=1),
          retrieval_function=retrieval_function,
      )
  
      my_cache.put(5)
      assert my_cache.get(5, False) == (retrieval_function(key=5), True)
  
      my_cache.put(6, 7)
      assert my_cache.get(6, False) == (7, True)
      assert len(my_cache) == 2
  
      my_cache.put(5, 6)
      assert my_cache.get(5, False) == (6, True)
      assert len(my_cache) == 2
  
      with pytest.raises(KeyError):
          my_cache.get(21, False)
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/utilities/test_cache.py
imports: from __future__ import absolute_import
  from typing import Optional, Union
  from mock.mock import MagicMock, patch
  import pytest
  from sagemaker.utilities import cache
  import datetime
label_desc: Use image node_id 2 for calling a global function with example usage: test_cache_retrieves_item() without return types