exception handling in sco_cache set

This commit is contained in:
Emmanuel Viennet 2021-07-26 18:11:45 +03:00
parent 0252bf4df4
commit 79e43adbc3

View File

@ -85,7 +85,7 @@ class ScoDocCache:
try:
return CACHE.get(cls._get_key(oid))
except pylibmc.Error:
log("Warning: memcached error")
log("Warning: memcached error in get")
log(traceback.format_exc())
return None
@ -94,9 +94,13 @@ class ScoDocCache:
"""Store value"""
key = cls._get_key(oid)
# log(f"CACHE key={key}, type={type(value)}, timeout={cls.timeout}")
try:
status = CACHE.set(key, value, timeout=cls.timeout)
if not status:
log("Error: cache set failed !")
except pylibmc.Error:
log("Warning: memcached error in set")
return status
@classmethod