refactor: memory model clears its cache when reading a model

This commit is contained in:
Éloi Rivard 2024-04-17 10:51:53 +02:00
parent 0ba1c93152
commit 6601abaeb4
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184

View file

@ -47,7 +47,11 @@ class MemoryModel(BackendModel):
states = [cls.index()[id] for id in ids]
# initialize instances from the states
return [cls(**state) for state in states]
instances = [cls(**state) for state in states]
for instance in instances:
# TODO: maybe find a way to not initialize the cache in the first place?
instance._cache = {}
return instances
@classmethod
def index(cls, class_name=None):