Added first version of DebugManager. Implemented draft of the rule engine

This commit is contained in:
2020-11-20 13:41:45 +01:00
parent cd066881b4
commit 315f8ea09b
156 changed files with 8388 additions and 2852 deletions
+21 -16
View File
@@ -86,6 +86,15 @@ class BaseCache:
with self._lock:
return self._get(key)
def get_all(self):
"""
Retrieve all items already in cache
This method does not fetch in the remoter repository
:return:
"""
with self._lock:
return self._cache.values()
def inner_get(self, key):
return self._cache[key]
@@ -108,6 +117,17 @@ class BaseCache:
except KeyError:
pass
def populate(self, populate_function, get_key_function):
"""
Initialise the cache with a bunch of data
:param populate_function:
:param get_key_function:
:return:
"""
with self._lock:
for item in populate_function():
self.put(get_key_function(item), item)
def has(self, key):
"""
Return True if the key is in the cache
@@ -194,7 +214,7 @@ class BaseCache:
with self._lock:
return self._cache.copy()
def init_from(self, dump):
def init_from_dump(self, dump):
with self._lock:
self._current_size = dump["current_size"]
self._cache = dump["cache"].copy()
@@ -259,18 +279,3 @@ class BaseCache:
def _delete(self, key, value):
raise NotImplementedError()
# def _put(self, key, value):
# self._cache[key] = value
# self._add_to_add(key)
# return True
#
#
# def _update(self, old_key, old_value, new_key, new_value):
# self._cache[new_key] = new_value
# self._add_to_add(new_key)
#
# if new_key != old_key:
# del (self._cache[old_key])
# self._add_to_remove(old_key)