aioredis.abc
— Interfaces Reference¶
This module defines several abstract classes that must be used when implementing custom connection managers or other features.
-
class
aioredis.abc.
AbcConnection
¶ Bases:
abc.ABC
Abstract connection interface.
-
address
¶ Connection address.
-
close
()¶ Perform connection(s) close and resources cleanup.
-
closed
¶ Flag indicating if connection is closing or already closed.
-
db
¶ Current selected DB index.
-
encoding
¶ Current set connection codec.
-
execute
(command, *args, **kwargs)¶ Execute redis command.
-
execute_pubsub
(command, *args, **kwargs)¶ Execute Redis (p)subscribe/(p)unsubscribe commands.
-
in_pubsub
¶ Returns number of subscribed channels.
Can be tested as bool indicating Pub/Sub mode state.
-
pubsub_channels
¶ Read-only channels dict.
-
pubsub_patterns
¶ Read-only patterns dict.
-
coroutine
wait_closed
()¶ Coroutine waiting until all resources are closed/released/cleaned up.
-
-
class
aioredis.abc.
AbcPool
¶ Bases:
aioredis.abc.AbcConnection
Abstract connections pool interface.
Inherited from AbcConnection so both have common interface for executing Redis commands.
-
coroutine
acquire
()¶ Acquires connection from pool.
-
address
¶ Connection address or None.
-
get_connection
()¶ Gets free connection from pool in a sync way.
If no connection available — returns None.
-
release
(conn)¶ Releases connection to pool.
Parameters: conn (AbcConnection) – Owned connection to be released.
-
coroutine
-
class
aioredis.abc.
AbcChannel
¶ Bases:
abc.ABC
Abstract Pub/Sub Channel interface.
-
close
()¶ Marks Channel as closed, no more messages will be sent to it.
Called by RedisConnection when channel is unsubscribed or connection is closed.
-
coroutine
get
()¶ Wait and return new message.
Will raise
ChannelClosedError
if channel is not active.
-
is_active
¶ Flag indicating that channel has unreceived messages and not marked as closed.
-
is_pattern
¶ Boolean flag indicating if channel is pattern channel.
-
name
¶ Encoded channel name or pattern.
-
put_nowait
(data)¶ Send data to channel.
Called by RedisConnection when new message received. For pattern subscriptions data will be a tuple of channel name and message itself.
-