AsyncRedisCommandQueue¶
Async Redis command queue.
AsyncRedisCommandQueue
¶
AsyncRedisCommandQueue - Асинхронный класс для работы с Redis.
Пример¶
import asyncio
from qtasks import QueueTasks
from qtasks.contrib.redis import AsyncRedisCommandQueue
redis_contrib = AsyncRedisCommandQueue(redis)
asyncio.run(redis_contrib.execute("hset", kwargs["name"], mapping=kwargs["mapping"]))
Source code in src/qtasks/contrib/redis/async_queue_client.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
__init__(redis, log=None)
¶
Экземпляр класса.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
redis
|
Redis
|
класс |
required |
log
|
Logger
|
класс |
None
|
Source code in src/qtasks/contrib/redis/async_queue_client.py
26 27 28 29 30 31 32 33 34 35 36 37 | |
execute(cmd, *args, **kwargs)
async
¶
Запрос в Redis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd
|
str
|
Команда. |
required |
args
|
tuple
|
Параметры к команде через *args. |
()
|
kwargs
|
dict
|
Параметры к команде через *args. |
{}
|
Source code in src/qtasks/contrib/redis/async_queue_client.py
52 53 54 55 56 57 58 59 60 61 62 63 | |