diff --git a/imperative/python/megengine/utils/persistent_cache.py b/imperative/python/megengine/utils/persistent_cache.py index b0bd351d426fac7a01cdf54861787b2b658ecfd7..b88e58d290cb6d93956165f23ee9ac1112f19e59 100644 --- a/imperative/python/megengine/utils/persistent_cache.py +++ b/imperative/python/megengine/utils/persistent_cache.py @@ -19,6 +19,8 @@ from ..version import __version__ class _FakeRedisConn: + cache_file = None + def __init__(self): try: from ..hub.hub import _get_megengine_home @@ -27,8 +29,8 @@ class _FakeRedisConn: os.path.join(_get_megengine_home(), "persistent_cache") ) os.makedirs(cache_dir, exist_ok=True) - cache_file = os.path.join(cache_dir, "cache") - self._dict = shelve.open(cache_file) + self.cache_file = os.path.join(cache_dir, "cache") + self._dict = shelve.open(self.cache_file) self._is_shelve = True except: self._dict = {}