GitHub

RedisPyService

API reference for RedisPyService.

The redis-py client behind Redis: client itself (to call on its loop), and use(f), running f(client) there.

Attributes

AttributeTypeDescription
clientAsyncRedis

Functions

__init__

__init__(client, _loop) -> None
ParameterTypeDescription
clientAsyncRedis
_loop_Loop

use

use[A](f) -> Effect[A, RedisError]

Run f(client) on the client's loop; its error becomes a RedisError.

ParameterTypeDescription
fCallable[[AsyncRedis], Awaitable[A]]

Returns Effect[A, RedisError]

def use[A](self, f: Callable[[AsyncRedis], Awaitable[A]]) -> Effect[A, RedisError]:
    """Run ``f(client)`` on the client's loop; its error becomes a
    ``RedisError``."""

    async def run() -> A:
        return await f(self.client)

    return self._loop.run(run, waits_for="work")