Commit 16088151 authored by Chris Lamb's avatar Chris Lamb 💬

Support an anti-dogpiling "lock" utility.

parent 961be8b0
import contextlib
from django.core.cache import cache
# Not all cache backends support .lock()
if hasattr(cache, 'lock'):
def lock(*args, **kwargs):
return cache.lock(*args, **kwargs)
else:
@contextlib.contextmanager
def lock(*args, **kwargs):
yield
......@@ -14,3 +14,4 @@ coverage==4.5.3
python-dateutil==2.6.0
django-storages==1.5.2
boto==2.45.0
django-redis==4.10.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment