Skip to content

Commit

Permalink
Fix redis storage
Browse files Browse the repository at this point in the history
  • Loading branch information
k0t3n committed Feb 1, 2024
1 parent 04466fd commit 9b31ece
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cachepot/storages/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@


class RedisStorage(AbstractStorage):
def __init__(self, redis: Redis[bytes]):
def __init__(self, redis: 'Redis[bytes]'):
assert isinstance(redis, Redis), 'Invalid Redis client passed'
self.redis: Redis[bytes] = redis

async def get(self, key: str) -> Optional[bytes]:
data = await self.redis.get(key)
if data and not isinstance(data, bytes):
return bytes(data)
return None
return data

async def set(self, key: str, value: bytes, expire: Optional[int] = None) -> bool:
await self.redis.set(key, value, ex=expire)
Expand Down

0 comments on commit 9b31ece

Please sign in to comment.