GitHub

RedisService

API reference for RedisService.

A Redis client: commands and scripts on shared connections, subscriptions, and connections of its own (reserve).

Attributes

AttributeTypeDescription
reserveEffect[RedisConnection, RedisError, Scope]

A connection for this scope alone, for blocking commands (XREAD BLOCK, BLPOP) that would hold up the shared ones. One released with a command still running, or after a failed command, is closed instead of reused.

Functions

subscribe

subscribe(channel, *, capacity=DEFAULT_SUBSCRIBE_CAPACITY) -> Effect[Dequeue[RedisMessage, RedisError], Never, Scope]

Messages published to channel until the scope closes; a failed subscription fails the dequeue. The dequeue holds at most capacity messages not yet taken; one more fails it (after those) with an error saying the subscriber fell behind.

ParameterTypeDescription
channelstr
capacityint = DEFAULT_SUBSCRIBE_CAPACITY

Returns Effect[Dequeue[RedisMessage, RedisError], Never, Scope]

def subscribe(
    self, channel: str, *, capacity: int = DEFAULT_SUBSCRIBE_CAPACITY
) -> Effect[Dequeue[RedisMessage, RedisError], Never, Scope]:
    """Messages published to ``channel`` until the scope closes; a
    failed subscription fails the dequeue. The dequeue holds at most
    ``capacity`` messages not yet taken; one more fails it (after
    those) with an error saying the subscriber fell behind."""
    ...

send

send(command, *args) -> Effect[RedisReply, RedisError]

Send command with args and give its reply.

ParameterTypeDescription
commandstr
argsstr = ()

Returns Effect[RedisReply, RedisError]

def send(self, command: str, *args: str) -> Effect[RedisReply, RedisError]:
    """Send ``command`` with ``args`` and give its reply."""
    ...

eval

eval[**P, A](script) -> Callable[P, Effect[A, RedisError]]

A function running script with EVALSHA, loading it first (and again when Redis answers NOSCRIPT).

ParameterTypeDescription
scriptScript[P, A]

Returns Callable[P, Effect[A, RedisError]]

def eval[**P, A](self, script: Script[P, A]) -> Callable[P, Effect[A, RedisError]]:
    """A function running ``script`` with ``EVALSHA``, loading it first
    (and again when Redis answers ``NOSCRIPT``)."""
    ...