def wrapper(admin, model): cache_method_key = helper.cache_method_key(model, func.__name__) value = django_cache.get(cache_method_key) if not value: value = func(admin, model) cache_object_key = helper.cache_object_key(model) obj_methods_caches = django_cache.get(cache_object_key) or '' django_cache.set_many({ cache_method_key: value, cache_object_key: obj_methods_caches + '|' + cache_method_key }, seconds) return value
def wrapper(admin, model): cache_method_key = helper.cache_method_key(model, func.__name__) value = django_cache.get(cache_method_key) if not value: value = func(admin, model) cache_object_key = helper.cache_object_key(model) obj_methods_caches = django_cache.get(cache_object_key) or '' django_cache.set_many( { cache_method_key: value, cache_object_key: obj_methods_caches + '|' + cache_method_key }, seconds) return value
def clear_cache(model): cache_object_key = helper.cache_object_key(model) obj_methods_caches = django_cache.get(cache_object_key) methods_key = obj_methods_caches.split('|') django_cache.delete_many(methods_key)
def clear_cache(model): cache_object_key = helper.cache_object_key(model) obj_methods_caches = django_cache.get(cache_object_key) methods_key = obj_methods_caches.split('|') django_cache.delete_many(methods_key)