home
·
contact
·
privacy
projects
/
plomtask
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eba83bd
)
On cache emptying, also ._disappear() any objects held in it.
author
Christian Heller
<c.heller@plomlompom.de>
Mon, 17 Jun 2024 23:03:19 +0000
(
01:03
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Mon, 17 Jun 2024 23:03:19 +0000
(
01:03
+0200)
plomtask/db.py
patch
|
blob
|
history
diff --git
a/plomtask/db.py
b/plomtask/db.py
index 3917ce0558e3f7deb1f917a07eb5dd4df7b279e6..385e79855286c45087537b3b63b8b024fd553ca0 100644
(file)
--- a/
plomtask/db.py
+++ b/
plomtask/db.py
@@
-315,7
+315,13
@@
class BaseModel(Generic[BaseModelId]):
@classmethod
def empty_cache(cls) -> None:
- """Empty class's cache."""
+ """Empty class's cache, and disappear all former inhabitants."""
+ # pylint: disable=protected-access
+ # (cause we remain within the class)
+ if hasattr(cls, 'cache_'):
+ to_disappear = list(cls.cache_.values())
+ for item in to_disappear:
+ item._disappear()
cls.cache_ = {}
@classmethod