Cache utils
import groundwork.core.cache
django_cached
django_cached( prefix: str, get_key: Any = None, ttl: int = 500) ‑> Callable[[~_T], ~_T]
Decorator to cache a function using the default cache.
Parameters
get_key
- Return a cache key given the arguments to the function
prefix
- Prefix applied to the cache key
ttl
- TTL in seconds
- Returns
- A function decorator
django_cached_model_property
django_cached_model_property( prefix: str, get_key: Any = None, ttl: int = 500) ‑> Callable[[~_T], ~_T]
Decorator to cache a model method using the default cache, scoped to the model instance.
Parameters
get_key
- Return a cache key given the arguments to the function
prefix
- Prefix applied to the cache key
ttl
- TTL in seconds
- Returns
- A method decorator