Use classmethod instead of staticmethod and avoid hard-coded reference

pull/471/head
Marc Hoersken 2019-10-04 08:55:55 +02:00
parent e05c7d9b4f
commit 4be029a0f6
1 changed files with 5 additions and 5 deletions

View File

@ -90,12 +90,12 @@ class MISPEncode(JSONEncoder):
class MISPFileCache(object):
# cache up to 150 JSON structures in class attribute
_file_cache = cachetools.LFUCache(150)
__file_cache = cachetools.LFUCache(150)
@staticmethod
def _load_json(path):
# use hard-coded root class attribute
file_cache = MISPFileCache._file_cache
@classmethod
def _load_json(cls, path):
# use root class attribute as global cache
file_cache = cls.__file_cache
# use modified time with path as cache key
mtime = os.path.getmtime(path)
if path in file_cache: