Skip to content

Commit 1966c3c

Browse files
Added a helper class ClusterKeyspaceNotifications that makes it easier to consume keyspace notifications from a Redis cluster.
1 parent b41e47d commit 1966c3c

File tree

4 files changed

+2222
-0
lines changed

4 files changed

+2222
-0
lines changed

redis/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
UnixDomainSocketConnection,
1212
)
1313
from redis.credentials import CredentialProvider, UsernamePasswordCredentialProvider
14+
from redis.keyspace_notifications import (
15+
ClusterKeyspaceNotifications,
16+
EventType,
17+
KeyeventChannel,
18+
KeyNotification,
19+
KeyNotificationType, # Backwards compatibility alias for EventType
20+
KeyspaceChannel,
21+
is_keyevent_channel,
22+
is_keyspace_channel,
23+
is_keyspace_notification_channel,
24+
)
1425
from redis.exceptions import (
1526
AuthenticationError,
1627
AuthenticationWrongNumberOfArgsError,
@@ -58,17 +69,26 @@ def int_or_str(value):
5869
"BlockingConnectionPool",
5970
"BusyLoadingError",
6071
"ChildDeadlockedError",
72+
"ClusterKeyspaceNotifications",
6173
"Connection",
6274
"ConnectionError",
6375
"ConnectionPool",
6476
"CredentialProvider",
6577
"CrossSlotTransactionError",
6678
"DataError",
6779
"DriverInfo",
80+
"EventType",
6881
"from_url",
6982
"default_backoff",
7083
"InvalidPipelineStack",
7184
"InvalidResponse",
85+
"is_keyevent_channel",
86+
"is_keyspace_channel",
87+
"is_keyspace_notification_channel",
88+
"KeyeventChannel",
89+
"KeyNotification",
90+
"KeyNotificationType",
91+
"KeyspaceChannel",
7292
"MaxConnectionsError",
7393
"OutOfMemoryError",
7494
"PubSubError",

0 commit comments

Comments
 (0)