diff options
author | 2021-03-05 02:44:25 +0100 | |
---|---|---|
committer | 2021-03-05 02:46:42 +0100 | |
commit | f7b56c533df7bf8c520f5cf69df5bf6dd62cf2dc (patch) | |
tree | 0f304d853cdfc17e14909619954b79f3f4ea72e3 | |
parent | Rename markup_hint to Markup (diff) |
Clarify the use of _set_expires and needs_expire
-rw-r--r-- | bot/exts/info/doc/_redis_cache.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bot/exts/info/doc/_redis_cache.py b/bot/exts/info/doc/_redis_cache.py index 7de2f3806..ad764816f 100644 --- a/bot/exts/info/doc/_redis_cache.py +++ b/bot/exts/info/doc/_redis_cache.py @@ -30,6 +30,9 @@ class DocRedisCache(RedisObject): with await self._get_pool_connection() as connection: if redis_key not in self._set_expires: + # An expire is only set if the key didn't exist before. + # If this is the first time setting values for this key check if it exists and add it to + # `_set_expires` to prevent redundant checks for subsequent uses with items from the same page. self._set_expires.add(redis_key) needs_expire = not await connection.exists(redis_key) |