API reference

Client

class redis_anyio.RedisClient(host='localhost', port=6379, *, db=0, ssl=False, username=None, password=None, pool_size=64, pool_overflow=2048, connect_timeout=10, retry_wait=<tenacity.wait.wait_exponential object>, retry_stop=<tenacity.stop._stop_never object>)
async blmove(source, destination, wherefrom, whereto, *, timeout=0, decode=True)

Atomically move an element from one array to another.

Unlike lmove(), this method first waits for an element to appear on source if it’s currently empty.

Parameters:
  • source (str) – the source key

  • destination (str) – the destination key

  • wherefrom (Literal['left', 'right']) – either left or right

  • whereto (Literal['left', 'right']) – either left or right

  • timeout (float) – seconds to wait for an element to appear on source; 0 to wait indefinitely

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

str | bytes

Returns:

the element being popped from source and moved to destination, or None if the timeout was reached

async blmpop(wherefrom, *keys, count=None, timeout=0, decode=True)

Remove and return one or more elements from one of the given lists.

Unlike lmpop(), this method first waits for an element to appear on any of the lists if all of them are empty.

Parameters:
  • wherefrom (Literal['left', 'right']) – left to remove an element from the beginning of the list, right to remove one from the end

  • keys (str) – the lists to remove elements from

  • count (Optional[int]) – the maximum number of elements to remove (omit to return the first element)

  • timeout (float) – seconds to wait for an element to appear on source; 0 to wait indefinitely

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

tuple[str, list[str] | list[bytes]]

Returns:

a tuple of (key, list of removed elements)

async blpop(*keys, timeout=0, decode=True)

Remove and return the first element from one of the given lists.

Unlike lpop(), this method first waits for an element to appear on any of the lists if all of them are empty.

Parameters:
  • keys (str) – the lists to pop from

  • timeout (int) – seconds to wait for an element to appear on any of the lists; 0 to wait indefinitely

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

Optional[tuple[str, str | bytes]]

Returns:

a tuple of (list name, the removed element), or None if the timeout was reached

async brpop(*keys, timeout=0, decode=True)

Remove and return the last element from one of the given lists.

Unlike rpop(), this method first waits for an element to appear on any of the lists if all of them are empty.

Parameters:
  • keys (str) – the lists to pop from

  • timeout (int) – seconds to wait for an element to appear on any of the lists; 0 to wait indefinitely

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

Optional[tuple[str, str | bytes]]

Returns:

a tuple of (list name, the removed element), or None if the timeout was reached

async delete(*keys)

Delete one or more keys in the database.

Return type:

int

Returns:

the number of keys that was removed.

async eval(script, keys, args, *, decode=True)

Run the given Lua script and return its result.

Parameters:
  • script (str) – the source code of the script

  • keys (list[str]) – the list of keys used in the script

  • args (list[object]) – the list of arguments passed to the script

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

Union[None, str, bytes, float, bool, VerbatimString, Decimal, List[ResponseValue], Set[ResponseValue], Dict[ResponseValue, ResponseValue]]

Returns:

the return value of the script

async evalsha(sha1, keys, args, *, decode=True)

Run a previously stored Lua script and return its result.

Parameters:
  • sha1 (str) – hex digest of a SHA-1 hash made from the script

  • keys (list[str]) – the list of keys used in the script

  • args (list[object]) – the list of arguments passed to the script

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

Union[None, str, bytes, float, bool, VerbatimString, Decimal, List[ResponseValue], Set[ResponseValue], Dict[ResponseValue, ResponseValue]]

Returns:

the return value of the script

async execute_command(command, *args, decode=True)

Execute a command on the Redis server.

Argument values that are not already bytes will be first converted to strings, and then encoded to bytes using the UTF-8 encoding.

Parameters:
  • command (str) – the command

  • args (object) – arguments to be sent

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

Union[None, str, bytes, float, bool, VerbatimString, Decimal, List[ResponseValue], Set[ResponseValue], Dict[ResponseValue, ResponseValue]]

Returns:

the return value of the command

Raises:
  • ConnectivityError – if there’s a connectivity problem (can’t connect to the server, connection prematurely closed, etc.)

  • ResponseError – if the server returns an error response

async expiretime(key)

Return the expiration time of the given key as a UNIX timestamp (in seconds).

Return type:

int

Returns:

the expiration time as an UNIX timestamp (in seconds), or -1 if the key exists but has no associated expiration time, or -2 if the key doesn’t exist

async flushall(sync=True)

Clears all keys in all databases.

Parameters:

sync (bool) – if True, flush the databases synchronously; if False, flush them asynchronously.

Return type:

None

async flushdb(sync=True)

Clears all keys in the currently selected database.

Parameters:

sync (bool) – if True, flush the database synchronously; if False, flush it asynchronously.

Return type:

None

async get(key, *, decode=True)

Retrieve the value of a key.

Parameters:
  • key (str) – the key whose value to retrieve

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

UnionType[str, bytes, None]

Returns:

the value of the key, or None if the key did not exist

async getrange(key, start, end, decode=True)

Return a substring of the string value stored at key.

Parameters:
  • key (str) – the key to retrieve

  • start (int) – index of the starting character (inclusive)

  • end (int) – index of the last character (inclusive)

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

str | bytes

Returns:

the substring

async hdel(key, field)

Delete a field in the given hash map.

Parameters:
  • key (str) – the hash map

  • field (str) – the field to delete

Return type:

int

Returns:

1 if the hash map contained the given field, or 0 if either the field or the hash map did not exist

async hexists(key, field)

Check if the given field exists in the given hash map.

Parameters:
  • key (str) – the hash map

  • field (str) – the field to check

Return type:

bool

Returns:

True if the hash map contains the given field, False if not

async hget(key, field, decode=True)

Retrieve the value of a field in a hash map stored at key.

Parameters:
  • key (str) – the hash to retrieve fields from

  • field (str) – the field to retrieve

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

UnionType[str, bytes, None]

Returns:

the key values, with None as a placeholder for fields that didn’t exist

async hgetall(key, decode=True)

Retrieve all fields and their values from a hash map stored at key.

Parameters:
  • key (str) – the hash map

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

dict[str, str] | dict[bytes, bytes]

Returns:

a mapping of fields to their values, or an empty dict if the hash map did not exist

async hincrby(key, field, increment)

Increment the value of the specified field in the given hash map.

If the field does not exist already, it will be created, with increment as the value.

Parameters:
  • key (str) – the hash map

  • field (str) – the name of the field to increment

  • increment (int) – the value to increment the field by

Return type:

int

Returns:

the value of the field after the increment operation

async hincrbyfloat(key, field, increment)

Increment the value of the specified field in the given hash map by a floating point value.

If the field does not exist already, it will be created, with increment as the value.

Parameters:
  • key (str) – the hash map

  • field (str) – the name of the field to increment

  • increment (float) – the (float) value to increment the field by

Return type:

str

Returns:

the value of the field after the increment operation, as a string

async hkeys(key)

Return the keys present in the given hash map.

Parameters:

key (str) – the hash map

Return type:

list[str]

Returns:

the list of keys in the hash map, or an empty list if the hash map doesn’t exist

async hlen(key)

Return the number of keys present in the given hash map.

Parameters:

key (str) – the hash map

Return type:

int

Returns:

the number of keys in the hash map, or 0 if the hash map doesn’t exist

async hmget(key, *fields, decode=True)

Retrieve the values of multiple fields in a hash stored at key.

Parameters:
  • key (str) – the hash to retrieve fields from

  • fields (str) – the fields to retrieve

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

list[Optional[str]] | list[Optional[bytes]]

Returns:

the key values, with None as a placeholder for fields that didn’t exist

async hrandfield(key, count=None, *, withvalues=False, decode=True)

Retrieve the value(s) of one or more random fields in the given hash map.

Parameters:
  • key (str) – the hash map

  • count (Optional[int]) – if given, the number of fields to fetch (can be negative; see the official documentation for details)

  • withvalues (bool) – if True, return a mapping of random fields to their values

  • decode (bool) – True to decode byte strings in field values to strings, False to leave them as is (applied only when count is specified and withvalues is True)

Return type:

UnionType[str, bytes, list[str], list[bytes], Mapping[str, str], Mapping[str, bytes], None]

Returns:

  • None if the hash map didn’t exist

  • If no count was specified: the value of a random field

  • If no count was specified, if count was not given; otherwise, a list of the fetched values

async hscan_iter(key, *, match=None, count, decode=True)

Iterate over the fields in the given hash map.

Parameters:
  • key (str) – the hash map

  • match (Optional[str]) – glob-style pattern to use for matching field names

  • count (Optional[int]) – maximum number of items to fetch on each iteration

  • decode (bool) – True to decode byte strings in field values to strings, False to leave them as is

Return type:

AsyncIterator[tuple[str, str]] | AsyncIterator[tuple[str, bytes]]

Returns:

an async context manager yielding an async iterator yielding tuples of (field name, field value)

Usage:

async for field, value in client.hscan("hashmapname", match="patter*"):
    print(f"Found field: {field} = {value}")
async hset(key, values)

Set the specified field values in the given hash map.

Parameters:
  • key (str) – the hash map to set the values in

  • values (Mapping[str, object]) – a mapping of field name to value

Return type:

int

Returns:

the number of fields that were added

Usage:

await client.hset("somekey", {"key1": value1, "key2": value2})
async keys(pattern)

Return the keys in the database matching the given pattern.

Parameters:

pattern (str) – the pattern to match against

Return type:

list[str]

Returns:

the list of keys in the database that match the pattern

async lindex(key, index, *, decode=True)

Return the element at index index in key key.

Parameters:
  • key (str) – the list to get the element from

  • index (int) – numeric index on the list

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

str | bytes

Returns:

the element at the specified index

async linsert(key, where, pivot, element)

Insert element to the list key either before or after pivot.

Parameters:
  • key (str) – the list to get the element from

  • where (Literal['before', 'after']) – before to insert the element before the reference value, after to insert the element after the reference value

  • pivot (object) – the reference value to look for

  • element (object) – the element to be inserted

Return type:

int

Returns:

the length of the list after a successful operation; 0 if the key doesn’t exist, and -1 when the pivot wasn’t found

async llen(key)

Remove and return the first element(s) value of a key.

Parameters:

key (str) – the array whose length to measure

Return type:

int

Returns:

the length of the array

async lmove(source, destination, wherefrom, whereto, *, decode=True)

Atomically move an element from one array to another.

Parameters:
  • source (str) – the source key

  • destination (str) – the destination key

  • wherefrom (Literal['left', 'right']) – either left or right

  • whereto (Literal['left', 'right']) – either left or right

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

UnionType[str, bytes, None]

Returns:

the element being popped from source and moved to destination, or None if source was empty

async lmpop(wherefrom, *keys, count=None, decode=True)

Remove and return one or more elements from one of the given lists.

Parameters:
  • wherefrom (Literal['left', 'right']) – left to remove an element from the beginning of the list, right to remove one from the end

  • keys (str) – the lists to remove elements from

  • count (Optional[int]) – the maximum number of elements to remove (omit to return the first element)

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

Optional[tuple[str, list[str] | list[bytes]]]

Returns:

a tuple of (key, list of elements), or None if no elements were removed

lock(name, *, lifetime=30000, extend_interval=None, retry_interval=1000)

Create a lock object bound to this client.

Parameters:
  • name (str) – unique name of the lock

  • lifetime (int | timedelta) – the expiration time of the lock (in milliseconds or as a timedelta)

  • extend_interval (UnionType[int, timedelta, None]) – Wait this long until extending the expiration time of the lock (in milliseconds or as a timedelta). If omitted, extending happens 5 seconds before the expiration is due, or lifetime / 2 if the life time is under 10 seconds.

  • retry_interval (int | timedelta) – if the lock was already acquired by another client, wait this long until trying to reacquire it (in milliseconds or as a timedelta)

Return type:

RedisLock

Usage:

async with client.lock("lockname", 30000):
    ...

Alternatively, you can share the lock object among multiple tasks:

from anyio import create_task_group

async def task_function(lock):
    async with lock:
        ...

lock = client.lock("lockname", 30000)
async with create_task_group() as tg:
    for _ in range(5):
        tg.start_soon(task_function, lock)
async lpop(key, count=None, *, decode=True)

Remove and return the first element(s) from a list.

Parameters:
  • key (str) – the list to remove elements from

  • count (Optional[int]) – the number of elements to remove (omit to return the first element)

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

UnionType[str, bytes, list[str], list[bytes], None]

Returns:

  • a list of removed elements (if count was specified)

  • the removed element (if count was omitted)

  • None when no element could be popped.

async mget(*keys, decode=True)

Retrieve the values of multiple key.

Parameters:
  • keys (str) – the keys to retrieve

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

list[str] | list[bytes]

Returns:

the key values, with None as a placeholder for keys that didn’t exist

async mset(values)

Set the values of multiple keys.

Parameters:

values (Mapping[str | bytes, object]) – a mapping of keys to their values

Return type:

None

async pexpire(key, milliseconds, *, how=None)

Set the timeout of the given key (in milliseconds).

Return type:

int

Returns:

1 if the timeout was set, 0 if the key doesn’t exist or the operation was skipped due to the operation modified (how)

async pexpireat(key, timestamp, *, how=None)

Set the expiration time of the given key as a UNIX timestamp (in milliseconds).

Return type:

int

Returns:

1 if the timeout was set, 0 if the key doesn’t exist or the operation was skipped due to the operation modified (how)

async pexpiretime(key)

Return the expiration time of the given key as a UNIX timestamp (in milliseconds).

Return type:

int

Returns:

the expiration time as an UNIX timestamp (in milliseconds), or -1 if the key exists but has no associated expiration time, or -2 if the key doesn’t exist

pipeline()

Create a new command pipeline bound to this client. :rtype: RedisPipeline

See also

Redis pipelining

psubscribe(*patterns, send_connection_state_changes=False, decode=True)

Subscribe to one or more topic patterns.

Parameters:
  • send_connection_state_changes (bool) – if True, send messages about disconnects and reconnections in a specially named topic within the stream (see the publish/subscribe section of the documentation for further info)

  • decode (bool) – if True, decode the messages into strings using the UTF-8 encoding. If False, yield raw bytes instead.

Return type:

Union[Subscription[str], Subscription[bytes]]

Usage:

async with client.psubscribe("chann*", "ch[aie]n?el") as subscription:
    async for topic, data in subscription:
        ...  # Received data on <topic>
async pttl(key)

Return the remaining time to live of a key, in milliseconds.

Return type:

int

Returns:

the time to live, or -1 if the key exists but has no associated expiration time, or -2 if the key doesn’t exist

async publish(channel, message)

Publish a message to the given channel.

Parameters:
  • channel (str) – name of the channel to publish to

  • message (str | bytes) – the message to publish

Return type:

int

Returns:

the number of clients that received the message

async rpop(key, count=None, *, decode=True)

Remove and return the last element(s) from a list.

Parameters:
  • key (str) – the list to remove elements from

  • count (Optional[int]) – the number of elements to remove (omit to return the last element)

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

UnionType[str, bytes, list[str], list[bytes], None]

Returns:

  • a list of removed elements (if count was specified)

  • the removed element (if count was omitted)

  • None when no element could be popped.

async rpush(key, *values)

Insert the given values to the tail of the list stored at key.

Parameters:
  • key (str) – the array to insert elements to

  • values (object) – the values to insert

Return type:

int

Returns:

the length of the list after the operation

async rpushx(key, *values)

Insert the given values to the tail of the list stored at key.

Unlike rpush(), this variant only inserts the values if key already exists and is a list.

Parameters:
  • key (str) – the array to insert elements to

  • values (object) – the values to insert

Return type:

int

Returns:

the length of the list after the operation

async scan_iter(*, match=None, count=None, type_=None)

Iterate over the set of keys in the current database.

Parameters:
  • match (Optional[str]) – glob-style pattern to use for matching against keys

  • count (Optional[int]) – maximum number of items to fetch on each iteration

  • type – type of keys to match

Return type:

AsyncIterator[str]

Returns:

an async context manager yielding an async iterator yielding keys

Usage:

async for key in client.scan(match="patter*"):
    print(f"Found key: {key}")
async script_flush(sync=True)

Flush the Lua script cache.

Parameters:

sync (bool) – if True, flush the scripts synchronously; if False, flush them asynchronously.

Return type:

None

Returns:

the SHA-1 hex digest of the script

async script_load(script)

Load the given Lua script into the scripts cache (without executing it).

Parameters:

script (str) – the source code of the script

Return type:

str

Returns:

the SHA-1 hex digest of the script

async set(key, value, *, nx=False, xx=False, get=False, ex=None, px=None, exat=None, pxat=None, keepttl=False, decode=True)

Set key to hold the string value.

If both nx and xx are True, the nx setting wins.

If more than one of the ex, px, exat and pxat settings have been set, the order of preference is ex > px > exat > pxat, so ex would win if they all were defined.

Parameters:
  • key (str) – the key to set

  • value (object) – the value to set for the key

  • nx (bool) – if True, only set the key if it doesn’t already exist

  • xx (bool) – if True, only set the key if it already exists

  • ex (UnionType[int, timedelta, None]) – specified expire time, in seconds

  • px (UnionType[int, timedelta, None]) – specified expire time, in milliseconds

  • exat (UnionType[int, datetime, None]) – specified UNIX timestamp for expiration, in seconds

  • pxat (UnionType[int, datetime, None]) – specified UNIX timestamp for expiration, in milliseconds

  • get (bool) – if True, return the previous value of the key

  • keepttl (bool) – if True, retain the time to live associated with the key

  • decode (bool) – True to decode byte strings in the response to strings, False to leave them as is

Return type:

UnionType[str, bytes, None]

Returns:

the previous value, if get=True

async setrange(key, offset, value)

Overwrite part of the specific string key.

Parameters:
  • key (str) – the key to modify

  • offset (int) – offset (in bytes) where to place the replacement string

  • value (str) – the string to place at the offset

Return type:

int

Returns:

the length of the string after the modification

Warning

Take care when modifying multibyte (outside of the ASCII range) strings, as each character may require more than one byte.

async spublish(shardchannel, message)

Publish a message to the given shard channel.

Parameters:
  • shardchannel (str) – name of the shard channel to publish to

  • message (str | bytes) – the message to publish

Return type:

int

Returns:

the number of clients that received the message

ssubscribe(*shardchannels, send_connection_state_changes=False, decode=True)

Subscribe to one or more shard channels.

Parameters:
  • send_connection_state_changes (bool) – if True, send messages about disconnects and reconnections in a specially named topic within the stream (see the publish/subscribe section of the documentation for further info)

  • decode (bool) – if True, decode the messages into strings using the UTF-8 encoding. If False, yield raw bytes instead.

Return type:

Union[Subscription[str], Subscription[bytes]]

Usage:

async with client.ssubscribe("channel1", "channel2") as subscription:
    async for channel, data in subscription:
        ...  # Received data on <channel>
statistics()

Return statistics for the connection pool.

Return type:

RedisConnectionPoolStatistics

subscribe(*channels, send_connection_state_changes=False, decode=True)

Subscribe to one or more channels.

Parameters:
  • send_connection_state_changes (bool) – if True, send messages about disconnects and reconnections in a specially named topic within the stream (see the publish/subscribe section of the documentation for further info)

  • decode (bool) – if True, decode the messages into strings using the UTF-8 encoding. If False, yield raw bytes instead.

Return type:

Union[Subscription[str], Subscription[bytes]]

Usage:

async with client.subscribe("channel1", "channel2") as subscription:
    async for channel, data in subscription:
        ...  # Received data on <channel>
async time()

Return the current server time.

Return type:

tuple[int, int]

Returns:

a tuple of (UNIX timestamp in seconds, microseconds elapsed in the current second)

transaction()

Create a new transaction bound to this client.

A transaction is a pipeline with slightly different semantics. See the documentation of the RedisTransaction class for further details. :rtype: RedisTransaction

Types

class redis_anyio.VerbatimString(type_: bytes, value: bytes)

A string with embedded formatting information.

type: str

Specifies the formatting of the string; either txt for plain text, or mkd for Markdown.

class redis_anyio.Subscription(pool, channels, subscribe_category, message_category, send_connection_state_changes, decode, subscribe_command, unsubscribe_command)
class redis_anyio.Message(channel, message)
channel: str

This is the name of the channel the message was received on.

message: str | bytes

This is the actual received message. Unless you specified decode=False when subscribing, this will be a str. Otherwise it will be a bytes object.

class redis_anyio.RedisPipeline(pool)
delete(*keys)

Queue a DELETE command. :rtype: QueuedCommand[int]

async execute()

Execute the commands queued thus far.

Return type:

None

flushall(sync=True)

Queue an FLUSHALL command. :rtype: QueuedCommand[str]

flushdb(sync=True)

Queue an FLUSHDB command. :rtype: QueuedCommand[str]

get(key, *, decode=True)

Queue a GET command. :rtype: Union[QueuedCommand[str], QueuedCommand[bytes]]

hset(key, values)

Queue an HSET command. :rtype: QueuedCommand[int]

keys(pattern)

Queue a KEYS command. :rtype: QueuedCommand[list[str]]

pexpire(key, milliseconds, *, how=None)

Queue a PEXPIRE command. :rtype: QueuedCommand[int]

pexpireat(key, timestamp, *, how=None)

Queue a PEXPIREAT command. :rtype: QueuedCommand[int]

pexpiretime(key)

Queue a PEXPIRETIME command. :rtype: QueuedCommand[int]

pttl(key)

Queue a PTTL command. :rtype: QueuedCommand[int]

queue_command(command, *args, decode=True)

Queue an arbitrary command to be executed. :rtype: QueuedCommand[Any]

set(key, value, *, nx=False, xx=False, get=False, ex=None, px=None, exat=None, pxat=None, keepttl=False, decode=True)

Queue a SET command. :rtype: Union[QueuedCommand[Optional[str]], QueuedCommand[Optional[bytes]]]

class redis_anyio.RedisTransaction(pool)

Represents a Redis transaction.

This differs from RedisPipeline in the following ways:

  • If any of the commands fails to be queued, the transaction is discarded

    (using DISCARD) and the response error is raised

  • The commands in the pipeline are wrapped with MULTI and EXEC commands

async execute()

Execute the commands queued thus far in a transaction.

Raises:

ResponseError – if the server returns an error response when queuing one of the commands

Return type:

None

class redis_anyio.QueuedCommand(command, args, decode)

Represents a command queued in a pipeline or transaction.

result
The result of the command, once the pipeline or transaction has been executed.
class redis_anyio.RedisConnectionPoolStatistics(max_connections, total_connections, idle_connections, busy_connections)
max_connections: int

This is the maximum number of connections the connection pool allows.

total_connections: int

This is the total number of connections in the pool (idle + busy).

idle_connections: int

This is the maximum number of open connections available to be acquired.

busy_connections: int

This is the maximum number of connections currently acquired from the pool.

class redis_anyio.RedisLock(name, lifetime, extend_interval, retry_interval, client)

Constants

redis_anyio.CONNECTION_STATE_CHANNEL = '_connection_state'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

redis_anyio.DISCONNECTED = 'disconnected'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

redis_anyio.RECONNECTED = 'reconnected'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

Exceptions

exception redis_anyio.RedisError

Base class for all Redis related errors.

exception redis_anyio.ResponseError(code, message)

Raised when the server responds to a command with an error.

exception redis_anyio.ConnectivityError

Raised when an operation fails due to a non-retryable server connectivity error.

exception redis_anyio.ProtocolError

Raised when there’s a problem decoding incoming data from the server.