We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd20c01 commit 288ac25Copy full SHA for 288ac25
cache_helper/decorators.py
@@ -1,4 +1,7 @@
1
-from _pylibmc import Error as MemcachedError
+try:
2
+ from _pylibmc import Error as CacheSetError
3
+except ImportError:
4
+ from cache_helper.exceptions import CacheHelperException as CacheSetError
5
6
from django.core.cache import cache
7
from django.utils.functional import wraps
@@ -25,10 +28,11 @@ def wrapper(*args, **kwargs):
25
28
if value is None:
26
29
value = func(*args, **kwargs)
27
30
# Try and set the key, value pair in the cache.
- # But if it fails on a Memcached Error handle it.
31
+ # But if it fails on an error from the underlying
32
+ # cache system, handle it.
33
try:
34
cache.set(key, value, timeout)
- except MemcachedError:
35
+ except CacheSetError:
36
pass
37
38
return value
0 commit comments