Skip to content

Commit

Permalink
update cache.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSAMPERE committed Aug 29, 2019
1 parent 9253fd3 commit eeb8ea0
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions modules/results/cache.py
Expand Up @@ -22,17 +22,9 @@ class CacheManager():
"""Basic class to manage the cache system of the layer addition.
"""

def __init__(self, plg_userdir : str = None):
def __init__(self):
# Path to JSON cache file
test_cache_file = plg_userdir/"paths_cache.json"
if isinstance(test_cache_file, Path):
self.cache_file = test_cache_file.resolve()
logger.debug("*=====* {}".format(self.cache_file))
elif plg_userdir != None:
raise TypeError("pathlib.Path expected")
else:
raise ValueError("path to JSON cache file required to instantiate CacheManager")

self.cache_file = Path(__file__).parents[2]/"_user"/"cache.json"
# Objects for storing inaccessible elements
self.cached_dict = {}
self.cached_unreach_paths = []
Expand Down Expand Up @@ -68,8 +60,6 @@ def loader(self):
try:
with open(self.cache_file, 'r') as cache:
cache_loaded = json.load(cache)
logger.debug("*=====*".format(cache_loaded))
logger.debug("cache_loaded : {}".format(cache_loaded))
if len(cache_loaded) == 0:
logger.debug("Empty cache file.")
elif isinstance(cache_loaded[0], dict) :
Expand Down

0 comments on commit eeb8ea0

Please sign in to comment.