Adjusts cache get_or_set to work with tests

This commit is contained in:
Mouse Reeve 2022-01-09 12:16:01 -08:00
parent 593d1638f9
commit 556c9ea98f

View file

@ -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"""
value = cache.get(cache_key)
if value is None:
cache.set(cache_key, function(*args), timeout=timeout)
return cache.get(cache_key)
value = function(*args)
cache.set(cache_key, value, timeout=timeout)
return value