Added cache-resyncing to ProcPool. This makes sure to update all affected object caches

whenever the subprocess returns (this is potentially not good enough for long-running scripts,
will have to ponder that one). Made ProcPool work with MySQL (where it works much better). Tested and fixed many
small bugs.
This commit is contained in:
Griatch 2012-09-03 01:11:14 +02:00
parent 275d00d4db
commit ffcf4b3c2f
7 changed files with 121 additions and 14 deletions

View file

@ -71,13 +71,16 @@ def _set_cache(obj, name, val):
_SA(obj, "db_%s" % name, val)
_GA(obj, "save")()
_SA(obj, "_cached_db_%s" % name, val)
def _del_cache(obj, name):
"On-model cache deleter"
try:
_DA(obj, "_cached_db_%s" % name)
except AttributeError:
pass
def _clean_cache(obj):
"On-model cache resetter"
[_DA(obj, cname) for cname in obj.__dict__.keys() if cname.startswith("_cached_db_")]
# this cache holds the attributes loaded on objects, one dictionary
# of attributes per object.