Better docstrings

This commit is contained in:
Ivan Golikov 2025-01-08 22:19:08 +01:00
parent fcefa41956
commit c67826047d

View file

@ -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):