diff --git a/app/scodoc/sco_cache.py b/app/scodoc/sco_cache.py index ecbf80a6..193ebd68 100644 --- a/app/scodoc/sco_cache.py +++ b/app/scodoc/sco_cache.py @@ -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}") - status = CACHE.set(key, value, timeout=cls.timeout) - if not status: - log("Error: cache set failed !") + 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