Closed ohadperry closed 5 years ago
The best way to do so is to use the cache programmatically.
IE:
manager = CacheManager()
cache = manager.get_cache_region('get_something', 'long_term')
def get_do_samething():
try:
return cache.get('cache_key')
except KeyError:
result = do_something_for_real()
if result['status'] in FINAL_STEPS:
cache.put('cache_key', result)
return result
Thanks!
wondering if there is a way to implement conditional cache for a function based on it's results