From a4c464decba7cd2729d96e23b860ff92cddb3e6d Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sun, 4 Apr 2021 14:49:45 +0200 Subject: [PATCH] Fix used same variable name triggered reading var before setting --- jsoncache/ApplicationCache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsoncache/ApplicationCache.py b/jsoncache/ApplicationCache.py index 35fd7d6..b5f7b8c 100644 --- a/jsoncache/ApplicationCache.py +++ b/jsoncache/ApplicationCache.py @@ -92,14 +92,14 @@ class ApplicationCache(): def cache_anything(self, key_prefix: str = None, max_age: int = None, packer = IDENTITY, unpacker = IDENTITY): def decorator(fun): - key_prefix = key_prefix or fun.__name__ + cache_prefix = key_prefix or fun.__name__ @wraps(fun) def decorated(*args, no_cache: bool = False, cache_no_lookup: bool = False, cache_no_store: bool = False, **kwargs): cache_no_lookup = no_cache or cache_no_lookup cache_no_store = no_cache or cache_no_store no_cache_key = cache_no_lookup and cache_no_store if not no_cache_key: - cache_key = self.gen_key(key_prefix, args, kwargs) + cache_key = self.gen_key(cache_prefix, args, kwargs) if not cache_no_lookup: cached_data = self.load(key=cache_key, max_age=max_age) if cached_data is not None: