mirror of https://github.com/MISP/PyMISP
Use classmethod instead of staticmethod and avoid hard-coded reference
parent
e05c7d9b4f
commit
4be029a0f6
|
@ -90,12 +90,12 @@ class MISPEncode(JSONEncoder):
|
||||||
|
|
||||||
class MISPFileCache(object):
|
class MISPFileCache(object):
|
||||||
# cache up to 150 JSON structures in class attribute
|
# cache up to 150 JSON structures in class attribute
|
||||||
_file_cache = cachetools.LFUCache(150)
|
__file_cache = cachetools.LFUCache(150)
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def _load_json(path):
|
def _load_json(cls, path):
|
||||||
# use hard-coded root class attribute
|
# use root class attribute as global cache
|
||||||
file_cache = MISPFileCache._file_cache
|
file_cache = cls.__file_cache
|
||||||
# use modified time with path as cache key
|
# use modified time with path as cache key
|
||||||
mtime = os.path.getmtime(path)
|
mtime = os.path.getmtime(path)
|
||||||
if path in file_cache:
|
if path in file_cache:
|
||||||
|
|
Loading…
Reference in New Issue