def METHOD_NAME(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