forked from mirrors/bookwyrm
Adjusts cache get_or_set to work with tests
This commit is contained in:
parent
593d1638f9
commit
556c9ea98f
1 changed files with 3 additions and 2 deletions
|
@ -6,5 +6,6 @@ def get_or_set(cache_key, function, *args, timeout=None):
|
||||||
"""Django's built-in get_or_set isn't cutting it"""
|
"""Django's built-in get_or_set isn't cutting it"""
|
||||||
value = cache.get(cache_key)
|
value = cache.get(cache_key)
|
||||||
if value is None:
|
if value is None:
|
||||||
cache.set(cache_key, function(*args), timeout=timeout)
|
value = function(*args)
|
||||||
return cache.get(cache_key)
|
cache.set(cache_key, value, timeout=timeout)
|
||||||
|
return value
|
||||||
|
|
Loading…
Reference in a new issue