1 2 3 4 5 6 7 8 | def cache_result(callable, cache_key, timeout):
def inner(*args, **kwargs):
result = cache.get(cache_key)
if result is None:
result = callable(*args, **kwargs)
cache.set(cache_key, result, timeout)
return result
return inner
|
More like this
- Conditional cache decorator by alexisbellido 10 months ago
- Stales Cache Class Method Decorator by amitu 4 years, 8 months ago
- django ajax_view decorator by chizcracker 1 year ago
- Method Caching by bryanhelmig 1 year, 11 months ago
- Searching and Deleting Cache Entries in Admin tool by shootclub 1 year, 11 months ago
Comments