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.
-
abstract property
address
¶ Connection address.
-
abstract
close
()¶ Perform connection(s) close and resources cleanup.
-
abstract property
closed
¶ Flag indicating if connection is closing or already closed.
-
abstract property
db
¶ Current selected DB index.
-
abstract property
encoding
¶ Current set connection codec.
-
abstract
execute
(command, *args, **kwargs)¶ Execute redis command.
-
abstract
execute_pubsub
(command, *args, **kwargs)¶ Execute Redis (p)subscribe/(p)unsubscribe commands.
-
abstract property
in_pubsub
¶ Returns number of subscribed channels.
Can be tested as bool indicating Pub/Sub mode state.
-
abstract property
pubsub_channels
¶ Read-only channels dict.
-
abstract property
pubsub_patterns
¶ Read-only patterns dict.
-
abstract property
-
class
aioredis.abc.
AbcPool
¶ Bases:
aioredis.abc.AbcConnection
Abstract connections pool interface.
Inherited from AbcConnection so both have common interface for executing Redis commands.
-
abstract property
address
¶ Connection address or None.
-
abstract
get_connection
()¶ Gets free connection from pool in a sync way.
If no connection available — returns None.
-
abstract
release
(conn)¶ Releases connection to pool.
- Parameters
conn (AbcConnection) – Owned connection to be released.
-
abstract property
-
class
aioredis.abc.
AbcChannel
¶ Bases:
abc.ABC
Abstract Pub/Sub Channel interface.
-
abstract
close
(exc=None)¶ Marks Channel as closed, no more messages will be sent to it.
Called by RedisConnection when channel is unsubscribed or connection is closed.
-
abstract property
is_active
¶ Flag indicating that channel has unreceived messages and not marked as closed.
-
abstract property
is_pattern
¶ Boolean flag indicating if channel is pattern channel.
-
abstract property
name
¶ Encoded channel name or pattern.
-
abstract
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.
-
abstract