code: def test_cache():
      c = cachey.Cache(10000)
      cc = Cache(c)
  
      with cc:
          assert get({"x": (inc, 1)}, "x") == 2
  
      assert flag == [1]
      assert c.data["x"] == 2
  
      assert not cc.starttimes
      assert not cc.durations
  
      while flag:
          flag.pop()
      dsk = {"x": (inc, 1), "y": (inc, 2), "z": (add, "x", "y")}
      with cc:
          assert get(dsk, "z") == 5
  
      assert flag == [2]  # no x present
  
      assert not Callback.active
  
file_path: dask/dask/tests/test_cache.py
imports: from __future__ import annotations
  from operator import add
  from time import sleep
  import pytest
  from dask.cache import Cache
  from dask.callbacks import Callback
  from dask.local import get_sync
  from dask.threaded import get
label_desc: Use image node_id 2 for calling a global function with example usage: test_cache() without return types