Better docstrings
This commit is contained in:
		
							parent
							
								
									fcefa41956
								
							
						
					
					
						commit
						c67826047d
					
				
					 1 changed files with 10 additions and 1 deletions
				
			
		|  | @ -37,7 +37,10 @@ async def save_secret(data: Secret, redis: Redis) -> str: | ||||||
| 
 | 
 | ||||||
| @lru_cache | @lru_cache | ||||||
| async def _is_getdel_available(redis: Redis) -> bool: | 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: |     try: | ||||||
|         await redis.getdel("test:getdel:availability") |         await redis.getdel("test:getdel:availability") | ||||||
|     except ResponseError: |     except ResponseError: | ||||||
|  | @ -47,6 +50,12 @@ async def _is_getdel_available(redis: Redis) -> bool: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| async def getdel(redis: Redis, key: str) -> ResponseT: | 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 |     result: ResponseT | ||||||
| 
 | 
 | ||||||
|     if await _is_getdel_available(redis): |     if await _is_getdel_available(redis): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue