mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 00:50:35 +00:00
Revert return type for get_or_set
This commit is contained in:
parent
a5cf912ae8
commit
af5f71f5ac
1 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue