Get a value from the cache or call ``func`` to set it and return it.
Retrieves a key value from the cache and sets the value if it does not exist.
This implementation is slightly more advanced that Django's. It provides thundering herd
protection, which prevents multiple threads/processes from calling the value-generating
function at the same time.
:param key: Location of the value
:param func: Callable used to set the value if key does not exist.
:param timeout: Number of seconds to hold value in cache.
:param timeout: Time in seconds that value at key is considered fresh.
:type timeout: Number of seconds or None
:param lock_timeout: Time in seconds that the lock will stay active and prevent other threads from acquiring the lock.
:type lock_timeout: Number of seconds or None
:param stale_cache_timeout: Time in seconds that the stale cache will remain after the key has expired. If ``None`` is specified, the stale value will remain indefinitely.
:type stale_cache_timeout: Number of seconds or None
.. function:: reinsert_keys(self):
...
...
@@ -147,12 +162,9 @@ Cache Methods Provided by django-redis-cache