Revert return type for get_or_set

This commit is contained in:
Joeri de Ruiter 2023-09-13 10:21:30 +02:00
parent a5cf912ae8
commit af5f71f5ac

View file

@ -6,12 +6,12 @@ from django.core.cache import cache
def get_or_set(
cache_key: str,
function: Callable[..., str],
function: Callable[..., Any],
*args: Tuple[Any, ...],
timeout: Union[float, None] = None
) -> str:
) -> Any:
"""Django's built-in get_or_set isn't cutting it"""
value = str(cache.get(cache_key))
value = cache.get(cache_key)
if value is None:
value = function(*args)
cache.set(cache_key, value, timeout=timeout)