From d3072a23d460524e9bb64b8724afbd0b2c44e305 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 17 May 2020 10:58:54 +0300 Subject: PEP Improvisations: Fix cache if statement Add `not` in check is key exist in cache. --- bot/utils/cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/utils/cache.py b/bot/utils/cache.py index 1c0935faa..96e1aef95 100644 --- a/bot/utils/cache.py +++ b/bot/utils/cache.py @@ -21,7 +21,7 @@ def async_cache(max_size: int = 128, arg_offset: int = 0) -> Callable: """Decorator wrapper for the caching logic.""" key = ':'.join(str(args[arg_offset:])) - if key in async_cache.cache: + if key not in async_cache.cache: if len(async_cache.cache) > max_size: async_cache.cache.popitem(last=False) -- cgit v1.2.3