code: def test_cache_shelving(tmp_path):
      joblib_dir = (
          tmp_path
          / "joblib"
          / "nilearn"
          / "_utils"
          / "tests"
          / "test_cache_mixin"
          / "f"
      )
      mem = Memory(location=str(tmp_path), verbose=0)
      res = cache_mixin.cache(f, mem, shelve=True)(2)
      assert res.get() == 2
      assert len(_get_subdirs(joblib_dir)) == 1
      res = cache_mixin.cache(f, mem, shelve=True)(2)
      assert res.get() == 2
      assert len(_get_subdirs(joblib_dir)) == 1
  
file_path: nilearn/nilearn/_utils/tests/test_cache_mixin.py
imports: import os
  import shutil
  from pathlib import Path
  import pytest
  from joblib import Memory
  import nilearn
  from nilearn._utils import CacheMixin, cache_mixin
label_desc: Use image node_id 8 for calling a global function with example usage: test_cache_shelving(tmp_path) without return types