From c67826047d924e67ab36c7465f9fe59e5bc4b35d Mon Sep 17 00:00:00 2001 From: Ivan Golikov Date: Wed, 8 Jan 2025 22:19:08 +0100 Subject: [PATCH] Better docstrings --- pssecret_server/utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pssecret_server/utils.py b/pssecret_server/utils.py index 0fe0b23..ea10ef5 100644 --- a/pssecret_server/utils.py +++ b/pssecret_server/utils.py @@ -37,7 +37,10 @@ async def save_secret(data: Secret, redis: Redis) -> str: @lru_cache async def _is_getdel_available(redis: Redis) -> bool: - """GETDEL is not available in Redis prior to version 6.2""" + """Checks the availability of GETDEL command on the Redis server instance + + GETDEL is not available in Redis prior to version 6.2 + """ try: await redis.getdel("test:getdel:availability") except ResponseError: @@ -47,6 +50,12 @@ async def _is_getdel_available(redis: Redis) -> bool: async def getdel(redis: Redis, key: str) -> ResponseT: + """Gets the value of key and deletes the key + + Depending on the capabilities of Redis server this function + will either call GETDEL command, either first call GETSET with empty string + and DEL right after that. + """ result: ResponseT if await _is_getdel_available(redis):