python-redis-lock
Lock context manager implemented via redis SETNX/BLPOP
.. You would write your functions like this:
from django.core.cache import cache def function(): val = cache.get(key) if val: return val else: with cache.lock(key): val = cache.get(key) if val: return val else: # DO EXPENSIVE WORK val = ... cache.set(key, value) return val