mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add docs for storages.
This commit is contained in:
parent
a59c5af5d0
commit
53292dad15
4 changed files with 30 additions and 7 deletions
|
|
@ -41,7 +41,6 @@ class RedisStorage(BaseStorage):
|
|||
Get Redis connection
|
||||
|
||||
This property is awaitable.
|
||||
:return:
|
||||
"""
|
||||
if self._redis is None:
|
||||
self._redis = await aioredis.create_connection((self._host, self._port),
|
||||
|
|
@ -50,7 +49,9 @@ class RedisStorage(BaseStorage):
|
|||
**self._kwargs)
|
||||
return self._redis
|
||||
|
||||
async def get_record(self, *, chat: typing.Union[str, int, None] = None, user: typing.Union[str, int, None] = None):
|
||||
async def get_record(self, *,
|
||||
chat: typing.Union[str, int, None] = None,
|
||||
user: typing.Union[str, int, None] = None) -> typing.Dict:
|
||||
"""
|
||||
Get record from storage
|
||||
|
||||
|
|
@ -61,8 +62,8 @@ class RedisStorage(BaseStorage):
|
|||
chat, user = self.check_address(chat=chat, user=user)
|
||||
addr = f"{chat}:{user}"
|
||||
|
||||
redis = await self.redis
|
||||
data = await redis.execute('GET', addr)
|
||||
conn = await self.redis
|
||||
data = await conn.execute('GET', addr)
|
||||
if data is None:
|
||||
return {'state': None, 'data': {}}
|
||||
return json.loads(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue