code: def test_ordered_response_cache_cleanup():
      """
      Tests that the cleanup method of ordered cache works as expected, in
      particular that all entries <= the passed ID are cleared from the cache.
      """
      cache = OrderedResponseCache()
  
      for i in range(1, 21):
          assert cache.check_cache(i) is None
          cache.update_cache(i, str(i))
  
      assert len(cache.cache) == 20
      for i in range(1, 21):
          assert cache.check_cache(i) == str(i)
  
      # Expected: clean up all entries up to and including entry 10
      cache.cleanup(10)
      assert len(cache.cache) == 10
  
      with pytest.raises(RuntimeError):
          # Attempting to access value that has already been cleaned up
          cache.check_cache(10)
  
      for i in range(21, 31):
          # Check that more entries can be inserted
          assert cache.check_cache(i) is None
          cache.update_cache(i, str(i))
  
      # Cleanup everything
      cache.cleanup(30)
      assert len(cache.cache) == 0
  
      with pytest.raises(RuntimeError):
          cache.check_cache(30)
  
      # Cleanup requests received out of order are tolerated
      cache.cleanup(27)
      cache.cleanup(23)
  
file_path: ray/python/ray/tests/test_response_cache.py
imports: from ray.util.client.common import _id_is_newer, ResponseCache, OrderedResponseCache, INT32_MAX
  import threading
  import time
  import pytest
label_desc: Use image node_id 6 for calling a global function with example usage: test_ordered_response_cache_cleanup() without return types