diff options
| author | 2020-05-26 18:51:53 +0200 | |
|---|---|---|
| committer | 2020-05-26 19:07:14 +0200 | |
| commit | b630aceb1adb624f45465aeb698e844f9ea340c8 (patch) | |
| tree | dd1691b6109367549a0a30543482855b11472b41 | |
| parent | Fix edge case where pop might not delete. (diff) | |
Add better docstring for RedisCache.update
Diffstat (limited to '')
| -rw-r--r-- | bot/utils/redis_cache.py | 14 | 
1 files changed, 12 insertions, 2 deletions
diff --git a/bot/utils/redis_cache.py b/bot/utils/redis_cache.py index dd20b5842..b77ec47a2 100644 --- a/bot/utils/redis_cache.py +++ b/bot/utils/redis_cache.py @@ -319,8 +319,18 @@ class RedisCache:          return value -    async def update(self, items: Dict) -> None: -        """Update the Redis cache with multiple values.""" +    async def update(self, items: Dict[RedisType, RedisType]) -> None: +        """ +        Update the Redis cache with multiple values. + +        This works exactly like dict.update from a normal dictionary. You pass +        a dictionary with one or more key/value pairs into this method. If the keys +        do not exist in the RedisCache, they are created. If they do exist, the values +        are updated with the new ones from `items`. + +        Please note that both the keys and the values in the `items` dictionary +        must consist of valid RedisTypes - ints, floats, or strings. +        """          await self._validate_cache()          log.trace(f"Updating the cache with the following items:\n{items}")          await self._redis.hmset_dict(self._namespace, self._dict_to_typestring(items))  |