diff --git a/imperative/python/megengine/utils/persistent_cache.py b/imperative/python/megengine/utils/persistent_cache.py index d517b9226ddcbaf4ff2f94146fc31c233f813639..b6aadf8adec3db92ca47640b11d0cd4ab21a76de 100644 --- a/imperative/python/megengine/utils/persistent_cache.py +++ b/imperative/python/megengine/utils/persistent_cache.py @@ -34,12 +34,13 @@ class PersistentCacheOnServer(_PersistentCache): "in-file cache".format(exc) ) else: - self.add_config( - "redis", - redis_config, - "fastrun use redis cache", - "failed to connect to cache server", - ) + if redis_config is not None: + self.add_config( + "redis", + redis_config, + "fastrun use redis cache", + "failed to connect to cache server", + ) if cache_type != "MEMORY": path = self.get_cache_file(self.get_cache_dir()) self.add_config(