Flush in-memory cache to session after a limit is reached

Should fully close #3989.
Should help with #3235.
This commit is contained in:
Lonami Exo
2023-04-06 13:45:12 +02:00
parent cb04e269c0
commit 97b0ba6707
3 changed files with 42 additions and 1 deletions
+6
View File
@@ -52,3 +52,9 @@ class EntityCache:
def put(self, entity):
self.hash_map[entity.id] = (entity.hash, entity.ty)
def retain(self, filter):
self.hash_map = {k: v for k, v in self.hash_map.items() if filter(k)}
def __len__(self):
return len(self.hash_map)