redis 6.4.0__py3-none-any.whl → 7.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- redis/__init__.py +1 -1
- redis/_parsers/base.py +193 -8
- redis/_parsers/helpers.py +64 -6
- redis/_parsers/hiredis.py +16 -10
- redis/_parsers/resp3.py +11 -5
- redis/asyncio/client.py +65 -8
- redis/asyncio/cluster.py +57 -5
- redis/asyncio/connection.py +62 -2
- redis/asyncio/http/__init__.py +0 -0
- redis/asyncio/http/http_client.py +265 -0
- redis/asyncio/multidb/__init__.py +0 -0
- redis/asyncio/multidb/client.py +530 -0
- redis/asyncio/multidb/command_executor.py +339 -0
- redis/asyncio/multidb/config.py +210 -0
- redis/asyncio/multidb/database.py +69 -0
- redis/asyncio/multidb/event.py +84 -0
- redis/asyncio/multidb/failover.py +125 -0
- redis/asyncio/multidb/failure_detector.py +38 -0
- redis/asyncio/multidb/healthcheck.py +285 -0
- redis/background.py +204 -0
- redis/cache.py +1 -0
- redis/client.py +97 -16
- redis/cluster.py +14 -3
- redis/commands/core.py +348 -313
- redis/commands/helpers.py +0 -20
- redis/commands/json/commands.py +2 -2
- redis/commands/search/__init__.py +2 -2
- redis/commands/search/aggregation.py +24 -26
- redis/commands/search/commands.py +10 -10
- redis/commands/search/field.py +2 -2
- redis/commands/search/query.py +23 -23
- redis/commands/vectorset/__init__.py +1 -1
- redis/commands/vectorset/commands.py +43 -25
- redis/commands/vectorset/utils.py +40 -4
- redis/connection.py +1257 -83
- redis/data_structure.py +81 -0
- redis/event.py +84 -10
- redis/exceptions.py +8 -0
- redis/http/__init__.py +0 -0
- redis/http/http_client.py +425 -0
- redis/maint_notifications.py +810 -0
- redis/multidb/__init__.py +0 -0
- redis/multidb/circuit.py +144 -0
- redis/multidb/client.py +526 -0
- redis/multidb/command_executor.py +350 -0
- redis/multidb/config.py +207 -0
- redis/multidb/database.py +130 -0
- redis/multidb/event.py +89 -0
- redis/multidb/exception.py +17 -0
- redis/multidb/failover.py +125 -0
- redis/multidb/failure_detector.py +104 -0
- redis/multidb/healthcheck.py +282 -0
- redis/retry.py +14 -1
- redis/utils.py +34 -0
- {redis-6.4.0.dist-info → redis-7.0.0.dist-info}/METADATA +7 -4
- redis-7.0.0.dist-info/RECORD +105 -0
- redis-6.4.0.dist-info/RECORD +0 -78
- {redis-6.4.0.dist-info → redis-7.0.0.dist-info}/WHEEL +0 -0
- {redis-6.4.0.dist-info → redis-7.0.0.dist-info}/licenses/LICENSE +0 -0
redis/commands/core.py
CHANGED
|
@@ -71,7 +71,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
71
71
|
If ``category`` is supplied, returns a list of all commands within
|
|
72
72
|
that category.
|
|
73
73
|
|
|
74
|
-
For more information see https://redis.io/commands/acl-cat
|
|
74
|
+
For more information, see https://redis.io/commands/acl-cat
|
|
75
75
|
"""
|
|
76
76
|
pieces: list[EncodableT] = [category] if category else []
|
|
77
77
|
return self.execute_command("ACL CAT", *pieces, **kwargs)
|
|
@@ -80,7 +80,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
80
80
|
"""
|
|
81
81
|
Simulate the execution of a given command by a given ``username``.
|
|
82
82
|
|
|
83
|
-
For more information see https://redis.io/commands/acl-dryrun
|
|
83
|
+
For more information, see https://redis.io/commands/acl-dryrun
|
|
84
84
|
"""
|
|
85
85
|
return self.execute_command("ACL DRYRUN", username, *args, **kwargs)
|
|
86
86
|
|
|
@@ -88,7 +88,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
88
88
|
"""
|
|
89
89
|
Delete the ACL for the specified ``username``\\s
|
|
90
90
|
|
|
91
|
-
For more information see https://redis.io/commands/acl-deluser
|
|
91
|
+
For more information, see https://redis.io/commands/acl-deluser
|
|
92
92
|
"""
|
|
93
93
|
return self.execute_command("ACL DELUSER", *username, **kwargs)
|
|
94
94
|
|
|
@@ -117,7 +117,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
117
117
|
|
|
118
118
|
If ``username`` does not exist, return None
|
|
119
119
|
|
|
120
|
-
For more information see https://redis.io/commands/acl-getuser
|
|
120
|
+
For more information, see https://redis.io/commands/acl-getuser
|
|
121
121
|
"""
|
|
122
122
|
return self.execute_command("ACL GETUSER", username, **kwargs)
|
|
123
123
|
|
|
@@ -125,7 +125,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
125
125
|
"""The ACL HELP command returns helpful text describing
|
|
126
126
|
the different subcommands.
|
|
127
127
|
|
|
128
|
-
For more information see https://redis.io/commands/acl-help
|
|
128
|
+
For more information, see https://redis.io/commands/acl-help
|
|
129
129
|
"""
|
|
130
130
|
return self.execute_command("ACL HELP", **kwargs)
|
|
131
131
|
|
|
@@ -133,7 +133,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
133
133
|
"""
|
|
134
134
|
Return a list of all ACLs on the server
|
|
135
135
|
|
|
136
|
-
For more information see https://redis.io/commands/acl-list
|
|
136
|
+
For more information, see https://redis.io/commands/acl-list
|
|
137
137
|
"""
|
|
138
138
|
return self.execute_command("ACL LIST", **kwargs)
|
|
139
139
|
|
|
@@ -143,7 +143,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
143
143
|
:param int count: Get logs[0:count].
|
|
144
144
|
:rtype: List.
|
|
145
145
|
|
|
146
|
-
For more information see https://redis.io/commands/acl-log
|
|
146
|
+
For more information, see https://redis.io/commands/acl-log
|
|
147
147
|
"""
|
|
148
148
|
args = []
|
|
149
149
|
if count is not None:
|
|
@@ -158,7 +158,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
158
158
|
Reset ACL logs.
|
|
159
159
|
:rtype: Boolean.
|
|
160
160
|
|
|
161
|
-
For more information see https://redis.io/commands/acl-log
|
|
161
|
+
For more information, see https://redis.io/commands/acl-log
|
|
162
162
|
"""
|
|
163
163
|
args = [b"RESET"]
|
|
164
164
|
return self.execute_command("ACL LOG", *args, **kwargs)
|
|
@@ -170,7 +170,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
170
170
|
Note that the server must be configured with the ``aclfile``
|
|
171
171
|
directive to be able to load ACL rules from an aclfile.
|
|
172
172
|
|
|
173
|
-
For more information see https://redis.io/commands/acl-load
|
|
173
|
+
For more information, see https://redis.io/commands/acl-load
|
|
174
174
|
"""
|
|
175
175
|
return self.execute_command("ACL LOAD", **kwargs)
|
|
176
176
|
|
|
@@ -181,7 +181,7 @@ class ACLCommands(CommandsProtocol):
|
|
|
181
181
|
Note that the server must be configured with the ``aclfile``
|
|
182
182
|
directive to be able to save ACL rules to an aclfile.
|
|
183
183
|
|
|
184
|
-
For more information see https://redis.io/commands/acl-save
|
|
184
|
+
For more information, see https://redis.io/commands/acl-save
|
|
185
185
|
"""
|
|
186
186
|
return self.execute_command("ACL SAVE", **kwargs)
|
|
187
187
|
|
|
@@ -379,14 +379,14 @@ class ACLCommands(CommandsProtocol):
|
|
|
379
379
|
def acl_users(self, **kwargs) -> ResponseT:
|
|
380
380
|
"""Returns a list of all registered users on the server.
|
|
381
381
|
|
|
382
|
-
For more information see https://redis.io/commands/acl-users
|
|
382
|
+
For more information, see https://redis.io/commands/acl-users
|
|
383
383
|
"""
|
|
384
384
|
return self.execute_command("ACL USERS", **kwargs)
|
|
385
385
|
|
|
386
386
|
def acl_whoami(self, **kwargs) -> ResponseT:
|
|
387
387
|
"""Get the username for the current connection
|
|
388
388
|
|
|
389
|
-
For more information see https://redis.io/commands/acl-whoami
|
|
389
|
+
For more information, see https://redis.io/commands/acl-whoami
|
|
390
390
|
"""
|
|
391
391
|
return self.execute_command("ACL WHOAMI", **kwargs)
|
|
392
392
|
|
|
@@ -404,7 +404,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
404
404
|
Authenticates the user. If you do not pass username, Redis will try to
|
|
405
405
|
authenticate for the "default" user. If you do pass username, it will
|
|
406
406
|
authenticate for the given user.
|
|
407
|
-
For more information see https://redis.io/commands/auth
|
|
407
|
+
For more information, see https://redis.io/commands/auth
|
|
408
408
|
"""
|
|
409
409
|
pieces = []
|
|
410
410
|
if username is not None:
|
|
@@ -415,7 +415,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
415
415
|
def bgrewriteaof(self, **kwargs):
|
|
416
416
|
"""Tell the Redis server to rewrite the AOF file from data in memory.
|
|
417
417
|
|
|
418
|
-
For more information see https://redis.io/commands/bgrewriteaof
|
|
418
|
+
For more information, see https://redis.io/commands/bgrewriteaof
|
|
419
419
|
"""
|
|
420
420
|
return self.execute_command("BGREWRITEAOF", **kwargs)
|
|
421
421
|
|
|
@@ -424,7 +424,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
424
424
|
Tell the Redis server to save its data to disk. Unlike save(),
|
|
425
425
|
this method is asynchronous and returns immediately.
|
|
426
426
|
|
|
427
|
-
For more information see https://redis.io/commands/bgsave
|
|
427
|
+
For more information, see https://redis.io/commands/bgsave
|
|
428
428
|
"""
|
|
429
429
|
pieces = []
|
|
430
430
|
if schedule:
|
|
@@ -437,14 +437,14 @@ class ManagementCommands(CommandsProtocol):
|
|
|
437
437
|
the context of replication, by returning if the instance
|
|
438
438
|
is currently a master, slave, or sentinel.
|
|
439
439
|
|
|
440
|
-
For more information see https://redis.io/commands/role
|
|
440
|
+
For more information, see https://redis.io/commands/role
|
|
441
441
|
"""
|
|
442
442
|
return self.execute_command("ROLE")
|
|
443
443
|
|
|
444
444
|
def client_kill(self, address: str, **kwargs) -> ResponseT:
|
|
445
445
|
"""Disconnects the client at ``address`` (ip:port)
|
|
446
446
|
|
|
447
|
-
For more information see https://redis.io/commands/client-kill
|
|
447
|
+
For more information, see https://redis.io/commands/client-kill
|
|
448
448
|
"""
|
|
449
449
|
return self.execute_command("CLIENT KILL", address, **kwargs)
|
|
450
450
|
|
|
@@ -507,7 +507,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
507
507
|
Returns information and statistics about the current
|
|
508
508
|
client connection.
|
|
509
509
|
|
|
510
|
-
For more information see https://redis.io/commands/client-info
|
|
510
|
+
For more information, see https://redis.io/commands/client-info
|
|
511
511
|
"""
|
|
512
512
|
return self.execute_command("CLIENT INFO", **kwargs)
|
|
513
513
|
|
|
@@ -522,7 +522,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
522
522
|
replica, pubsub)
|
|
523
523
|
:param client_id: optional. a list of client ids
|
|
524
524
|
|
|
525
|
-
For more information see https://redis.io/commands/client-list
|
|
525
|
+
For more information, see https://redis.io/commands/client-list
|
|
526
526
|
"""
|
|
527
527
|
args = []
|
|
528
528
|
if _type is not None:
|
|
@@ -542,7 +542,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
542
542
|
"""
|
|
543
543
|
Returns the current connection name
|
|
544
544
|
|
|
545
|
-
For more information see https://redis.io/commands/client-getname
|
|
545
|
+
For more information, see https://redis.io/commands/client-getname
|
|
546
546
|
"""
|
|
547
547
|
return self.execute_command("CLIENT GETNAME", **kwargs)
|
|
548
548
|
|
|
@@ -583,7 +583,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
583
583
|
"""
|
|
584
584
|
Returns the current connection id
|
|
585
585
|
|
|
586
|
-
For more information see https://redis.io/commands/client-id
|
|
586
|
+
For more information, see https://redis.io/commands/client-id
|
|
587
587
|
"""
|
|
588
588
|
return self.execute_command("CLIENT ID", **kwargs)
|
|
589
589
|
|
|
@@ -598,7 +598,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
598
598
|
) -> ResponseT:
|
|
599
599
|
"""
|
|
600
600
|
Turn on the tracking mode.
|
|
601
|
-
For more information about the options look at client_tracking func.
|
|
601
|
+
For more information, about the options look at client_tracking func.
|
|
602
602
|
|
|
603
603
|
See https://redis.io/commands/client-tracking
|
|
604
604
|
"""
|
|
@@ -617,7 +617,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
617
617
|
) -> ResponseT:
|
|
618
618
|
"""
|
|
619
619
|
Turn off the tracking mode.
|
|
620
|
-
For more information about the options look at client_tracking func.
|
|
620
|
+
For more information, about the options look at client_tracking func.
|
|
621
621
|
|
|
622
622
|
See https://redis.io/commands/client-tracking
|
|
623
623
|
"""
|
|
@@ -640,7 +640,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
640
640
|
Enables the tracking feature of the Redis server, that is used
|
|
641
641
|
for server assisted client side caching.
|
|
642
642
|
|
|
643
|
-
``on`` indicate for tracking on or tracking off. The
|
|
643
|
+
``on`` indicate for tracking on or tracking off. The default is on.
|
|
644
644
|
|
|
645
645
|
``clientid`` send invalidation messages to the connection with
|
|
646
646
|
the specified ID.
|
|
@@ -698,7 +698,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
698
698
|
"""
|
|
699
699
|
Sets the current connection name
|
|
700
700
|
|
|
701
|
-
For more information see https://redis.io/commands/client-setname
|
|
701
|
+
For more information, see https://redis.io/commands/client-setname
|
|
702
702
|
|
|
703
703
|
.. note::
|
|
704
704
|
This method sets client name only for **current** connection.
|
|
@@ -724,7 +724,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
724
724
|
If ``error`` is False (default), the client is unblocked using the
|
|
725
725
|
regular timeout mechanism.
|
|
726
726
|
|
|
727
|
-
For more information see https://redis.io/commands/client-unblock
|
|
727
|
+
For more information, see https://redis.io/commands/client-unblock
|
|
728
728
|
"""
|
|
729
729
|
args = ["CLIENT UNBLOCK", int(client_id)]
|
|
730
730
|
if error:
|
|
@@ -736,7 +736,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
736
736
|
Suspend all the Redis clients for the specified amount of time.
|
|
737
737
|
|
|
738
738
|
|
|
739
|
-
For more information see https://redis.io/commands/client-pause
|
|
739
|
+
For more information, see https://redis.io/commands/client-pause
|
|
740
740
|
|
|
741
741
|
Args:
|
|
742
742
|
timeout: milliseconds to pause clients
|
|
@@ -763,7 +763,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
763
763
|
"""
|
|
764
764
|
Unpause all redis clients
|
|
765
765
|
|
|
766
|
-
For more information see https://redis.io/commands/client-unpause
|
|
766
|
+
For more information, see https://redis.io/commands/client-unpause
|
|
767
767
|
"""
|
|
768
768
|
return self.execute_command("CLIENT UNPAUSE", **kwargs)
|
|
769
769
|
|
|
@@ -771,7 +771,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
771
771
|
"""
|
|
772
772
|
Sets the client eviction mode for the current connection.
|
|
773
773
|
|
|
774
|
-
For more information see https://redis.io/commands/client-no-evict
|
|
774
|
+
For more information, see https://redis.io/commands/client-no-evict
|
|
775
775
|
"""
|
|
776
776
|
return self.execute_command("CLIENT NO-EVICT", mode)
|
|
777
777
|
|
|
@@ -782,7 +782,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
782
782
|
# When turned on, the current client will not change LFU/LRU stats,
|
|
783
783
|
# unless it sends the TOUCH command.
|
|
784
784
|
|
|
785
|
-
For more information see https://redis.io/commands/client-no-touch
|
|
785
|
+
For more information, see https://redis.io/commands/client-no-touch
|
|
786
786
|
"""
|
|
787
787
|
return self.execute_command("CLIENT NO-TOUCH", mode)
|
|
788
788
|
|
|
@@ -790,7 +790,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
790
790
|
"""
|
|
791
791
|
Returns dict reply of details about all Redis commands.
|
|
792
792
|
|
|
793
|
-
For more information see https://redis.io/commands/command
|
|
793
|
+
For more information, see https://redis.io/commands/command
|
|
794
794
|
"""
|
|
795
795
|
return self.execute_command("COMMAND", **kwargs)
|
|
796
796
|
|
|
@@ -815,7 +815,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
815
815
|
``category``: get the commands in the ACL category
|
|
816
816
|
``pattern``: get the commands that match the given pattern
|
|
817
817
|
|
|
818
|
-
For more information see https://redis.io/commands/command-list/
|
|
818
|
+
For more information, see https://redis.io/commands/command-list/
|
|
819
819
|
"""
|
|
820
820
|
pieces = []
|
|
821
821
|
if module is not None:
|
|
@@ -830,11 +830,11 @@ class ManagementCommands(CommandsProtocol):
|
|
|
830
830
|
|
|
831
831
|
return self.execute_command("COMMAND LIST", *pieces)
|
|
832
832
|
|
|
833
|
-
def command_getkeysandflags(self, *args:
|
|
833
|
+
def command_getkeysandflags(self, *args: str) -> List[Union[str, List[str]]]:
|
|
834
834
|
"""
|
|
835
835
|
Returns array of keys from a full Redis command and their usage flags.
|
|
836
836
|
|
|
837
|
-
For more information see https://redis.io/commands/command-getkeysandflags
|
|
837
|
+
For more information, see https://redis.io/commands/command-getkeysandflags
|
|
838
838
|
"""
|
|
839
839
|
return self.execute_command("COMMAND GETKEYSANDFLAGS", *args)
|
|
840
840
|
|
|
@@ -848,12 +848,12 @@ class ManagementCommands(CommandsProtocol):
|
|
|
848
848
|
)
|
|
849
849
|
|
|
850
850
|
def config_get(
|
|
851
|
-
self, pattern: PatternT = "*", *args:
|
|
851
|
+
self, pattern: PatternT = "*", *args: PatternT, **kwargs
|
|
852
852
|
) -> ResponseT:
|
|
853
853
|
"""
|
|
854
854
|
Return a dictionary of configuration based on the ``pattern``
|
|
855
855
|
|
|
856
|
-
For more information see https://redis.io/commands/config-get
|
|
856
|
+
For more information, see https://redis.io/commands/config-get
|
|
857
857
|
"""
|
|
858
858
|
return self.execute_command("CONFIG GET", pattern, *args, **kwargs)
|
|
859
859
|
|
|
@@ -861,12 +861,12 @@ class ManagementCommands(CommandsProtocol):
|
|
|
861
861
|
self,
|
|
862
862
|
name: KeyT,
|
|
863
863
|
value: EncodableT,
|
|
864
|
-
*args:
|
|
864
|
+
*args: Union[KeyT, EncodableT],
|
|
865
865
|
**kwargs,
|
|
866
866
|
) -> ResponseT:
|
|
867
867
|
"""Set config item ``name`` with ``value``
|
|
868
868
|
|
|
869
|
-
For more information see https://redis.io/commands/config-set
|
|
869
|
+
For more information, see https://redis.io/commands/config-set
|
|
870
870
|
"""
|
|
871
871
|
return self.execute_command("CONFIG SET", name, value, *args, **kwargs)
|
|
872
872
|
|
|
@@ -874,7 +874,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
874
874
|
"""
|
|
875
875
|
Reset runtime statistics
|
|
876
876
|
|
|
877
|
-
For more information see https://redis.io/commands/config-resetstat
|
|
877
|
+
For more information, see https://redis.io/commands/config-resetstat
|
|
878
878
|
"""
|
|
879
879
|
return self.execute_command("CONFIG RESETSTAT", **kwargs)
|
|
880
880
|
|
|
@@ -882,7 +882,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
882
882
|
"""
|
|
883
883
|
Rewrite config file with the minimal change to reflect running config.
|
|
884
884
|
|
|
885
|
-
For more information see https://redis.io/commands/config-rewrite
|
|
885
|
+
For more information, see https://redis.io/commands/config-rewrite
|
|
886
886
|
"""
|
|
887
887
|
return self.execute_command("CONFIG REWRITE", **kwargs)
|
|
888
888
|
|
|
@@ -890,7 +890,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
890
890
|
"""
|
|
891
891
|
Returns the number of keys in the current database
|
|
892
892
|
|
|
893
|
-
For more information see https://redis.io/commands/dbsize
|
|
893
|
+
For more information, see https://redis.io/commands/dbsize
|
|
894
894
|
"""
|
|
895
895
|
return self.execute_command("DBSIZE", **kwargs)
|
|
896
896
|
|
|
@@ -898,7 +898,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
898
898
|
"""
|
|
899
899
|
Returns version specific meta information about a given key
|
|
900
900
|
|
|
901
|
-
For more information see https://redis.io/commands/debug-object
|
|
901
|
+
For more information, see https://redis.io/commands/debug-object
|
|
902
902
|
"""
|
|
903
903
|
return self.execute_command("DEBUG OBJECT", key, **kwargs)
|
|
904
904
|
|
|
@@ -907,7 +907,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
907
907
|
"""
|
|
908
908
|
DEBUG SEGFAULT is intentionally not implemented in the client.
|
|
909
909
|
|
|
910
|
-
For more information see https://redis.io/commands/debug-segfault
|
|
910
|
+
For more information, see https://redis.io/commands/debug-segfault
|
|
911
911
|
"""
|
|
912
912
|
)
|
|
913
913
|
|
|
@@ -915,7 +915,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
915
915
|
"""
|
|
916
916
|
Echo the string back from the server
|
|
917
917
|
|
|
918
|
-
For more information see https://redis.io/commands/echo
|
|
918
|
+
For more information, see https://redis.io/commands/echo
|
|
919
919
|
"""
|
|
920
920
|
return self.execute_command("ECHO", value, **kwargs)
|
|
921
921
|
|
|
@@ -926,7 +926,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
926
926
|
``asynchronous`` indicates whether the operation is
|
|
927
927
|
executed asynchronously by the server.
|
|
928
928
|
|
|
929
|
-
For more information see https://redis.io/commands/flushall
|
|
929
|
+
For more information, see https://redis.io/commands/flushall
|
|
930
930
|
"""
|
|
931
931
|
args = []
|
|
932
932
|
if asynchronous:
|
|
@@ -940,7 +940,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
940
940
|
``asynchronous`` indicates whether the operation is
|
|
941
941
|
executed asynchronously by the server.
|
|
942
942
|
|
|
943
|
-
For more information see https://redis.io/commands/flushdb
|
|
943
|
+
For more information, see https://redis.io/commands/flushdb
|
|
944
944
|
"""
|
|
945
945
|
args = []
|
|
946
946
|
if asynchronous:
|
|
@@ -951,7 +951,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
951
951
|
"""
|
|
952
952
|
Initiates a replication stream from the master.
|
|
953
953
|
|
|
954
|
-
For more information see https://redis.io/commands/sync
|
|
954
|
+
For more information, see https://redis.io/commands/sync
|
|
955
955
|
"""
|
|
956
956
|
from redis.client import NEVER_DECODE
|
|
957
957
|
|
|
@@ -964,7 +964,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
964
964
|
Initiates a replication stream from the master.
|
|
965
965
|
Newer version for `sync`.
|
|
966
966
|
|
|
967
|
-
For more information see https://redis.io/commands/sync
|
|
967
|
+
For more information, see https://redis.io/commands/sync
|
|
968
968
|
"""
|
|
969
969
|
from redis.client import NEVER_DECODE
|
|
970
970
|
|
|
@@ -976,7 +976,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
976
976
|
"""
|
|
977
977
|
Swap two databases
|
|
978
978
|
|
|
979
|
-
For more information see https://redis.io/commands/swapdb
|
|
979
|
+
For more information, see https://redis.io/commands/swapdb
|
|
980
980
|
"""
|
|
981
981
|
return self.execute_command("SWAPDB", first, second, **kwargs)
|
|
982
982
|
|
|
@@ -987,9 +987,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
987
987
|
"""
|
|
988
988
|
return self.execute_command("SELECT", index, **kwargs)
|
|
989
989
|
|
|
990
|
-
def info(
|
|
991
|
-
self, section: Optional[str] = None, *args: List[str], **kwargs
|
|
992
|
-
) -> ResponseT:
|
|
990
|
+
def info(self, section: Optional[str] = None, *args: str, **kwargs) -> ResponseT:
|
|
993
991
|
"""
|
|
994
992
|
Returns a dictionary containing information about the Redis server
|
|
995
993
|
|
|
@@ -999,7 +997,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
999
997
|
The section option is not supported by older versions of Redis Server,
|
|
1000
998
|
and will generate ResponseError
|
|
1001
999
|
|
|
1002
|
-
For more information see https://redis.io/commands/info
|
|
1000
|
+
For more information, see https://redis.io/commands/info
|
|
1003
1001
|
"""
|
|
1004
1002
|
if section is None:
|
|
1005
1003
|
return self.execute_command("INFO", **kwargs)
|
|
@@ -1011,35 +1009,35 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1011
1009
|
Return a Python datetime object representing the last time the
|
|
1012
1010
|
Redis database was saved to disk
|
|
1013
1011
|
|
|
1014
|
-
For more information see https://redis.io/commands/lastsave
|
|
1012
|
+
For more information, see https://redis.io/commands/lastsave
|
|
1015
1013
|
"""
|
|
1016
1014
|
return self.execute_command("LASTSAVE", **kwargs)
|
|
1017
1015
|
|
|
1018
1016
|
def latency_doctor(self):
|
|
1019
1017
|
"""Raise a NotImplementedError, as the client will not support LATENCY DOCTOR.
|
|
1020
|
-
This
|
|
1018
|
+
This function is best used within the redis-cli.
|
|
1021
1019
|
|
|
1022
|
-
For more information see https://redis.io/commands/latency-doctor
|
|
1020
|
+
For more information, see https://redis.io/commands/latency-doctor
|
|
1023
1021
|
"""
|
|
1024
1022
|
raise NotImplementedError(
|
|
1025
1023
|
"""
|
|
1026
1024
|
LATENCY DOCTOR is intentionally not implemented in the client.
|
|
1027
1025
|
|
|
1028
|
-
For more information see https://redis.io/commands/latency-doctor
|
|
1026
|
+
For more information, see https://redis.io/commands/latency-doctor
|
|
1029
1027
|
"""
|
|
1030
1028
|
)
|
|
1031
1029
|
|
|
1032
1030
|
def latency_graph(self):
|
|
1033
1031
|
"""Raise a NotImplementedError, as the client will not support LATENCY GRAPH.
|
|
1034
|
-
This
|
|
1032
|
+
This function is best used within the redis-cli.
|
|
1035
1033
|
|
|
1036
|
-
For more information see https://redis.io/commands/latency-graph.
|
|
1034
|
+
For more information, see https://redis.io/commands/latency-graph.
|
|
1037
1035
|
"""
|
|
1038
1036
|
raise NotImplementedError(
|
|
1039
1037
|
"""
|
|
1040
1038
|
LATENCY GRAPH is intentionally not implemented in the client.
|
|
1041
1039
|
|
|
1042
|
-
For more information see https://redis.io/commands/latency-graph
|
|
1040
|
+
For more information, see https://redis.io/commands/latency-graph
|
|
1043
1041
|
"""
|
|
1044
1042
|
)
|
|
1045
1043
|
|
|
@@ -1055,7 +1053,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1055
1053
|
return self.execute_command("LOLWUT", **kwargs)
|
|
1056
1054
|
|
|
1057
1055
|
def reset(self) -> ResponseT:
|
|
1058
|
-
"""Perform a full reset on the connection's server
|
|
1056
|
+
"""Perform a full reset on the connection's server-side context.
|
|
1059
1057
|
|
|
1060
1058
|
See: https://redis.io/commands/reset
|
|
1061
1059
|
"""
|
|
@@ -1090,7 +1088,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1090
1088
|
If ``auth`` is specified, authenticate to the destination server with
|
|
1091
1089
|
the password provided.
|
|
1092
1090
|
|
|
1093
|
-
For more information see https://redis.io/commands/migrate
|
|
1091
|
+
For more information, see https://redis.io/commands/migrate
|
|
1094
1092
|
"""
|
|
1095
1093
|
keys = list_or_args(keys, [])
|
|
1096
1094
|
if not keys:
|
|
@@ -1122,7 +1120,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1122
1120
|
"""
|
|
1123
1121
|
MEMORY DOCTOR is intentionally not implemented in the client.
|
|
1124
1122
|
|
|
1125
|
-
For more information see https://redis.io/commands/memory-doctor
|
|
1123
|
+
For more information, see https://redis.io/commands/memory-doctor
|
|
1126
1124
|
"""
|
|
1127
1125
|
)
|
|
1128
1126
|
|
|
@@ -1131,7 +1129,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1131
1129
|
"""
|
|
1132
1130
|
MEMORY HELP is intentionally not implemented in the client.
|
|
1133
1131
|
|
|
1134
|
-
For more information see https://redis.io/commands/memory-help
|
|
1132
|
+
For more information, see https://redis.io/commands/memory-help
|
|
1135
1133
|
"""
|
|
1136
1134
|
)
|
|
1137
1135
|
|
|
@@ -1139,7 +1137,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1139
1137
|
"""
|
|
1140
1138
|
Return a dictionary of memory stats
|
|
1141
1139
|
|
|
1142
|
-
For more information see https://redis.io/commands/memory-stats
|
|
1140
|
+
For more information, see https://redis.io/commands/memory-stats
|
|
1143
1141
|
"""
|
|
1144
1142
|
return self.execute_command("MEMORY STATS", **kwargs)
|
|
1145
1143
|
|
|
@@ -1162,7 +1160,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1162
1160
|
sample. If left unspecified, the server's default is 5. Use 0 to sample
|
|
1163
1161
|
all elements.
|
|
1164
1162
|
|
|
1165
|
-
For more information see https://redis.io/commands/memory-usage
|
|
1163
|
+
For more information, see https://redis.io/commands/memory-usage
|
|
1166
1164
|
"""
|
|
1167
1165
|
args = []
|
|
1168
1166
|
if isinstance(samples, int):
|
|
@@ -1173,7 +1171,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1173
1171
|
"""
|
|
1174
1172
|
Attempts to purge dirty pages for reclamation by allocator
|
|
1175
1173
|
|
|
1176
|
-
For more information see https://redis.io/commands/memory-purge
|
|
1174
|
+
For more information, see https://redis.io/commands/memory-purge
|
|
1177
1175
|
"""
|
|
1178
1176
|
return self.execute_command("MEMORY PURGE", **kwargs)
|
|
1179
1177
|
|
|
@@ -1190,7 +1188,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1190
1188
|
"""
|
|
1191
1189
|
Returns the raw data of the ``event``'s latency spikes time series.
|
|
1192
1190
|
|
|
1193
|
-
For more information see https://redis.io/commands/latency-history
|
|
1191
|
+
For more information, see https://redis.io/commands/latency-history
|
|
1194
1192
|
"""
|
|
1195
1193
|
return self.execute_command("LATENCY HISTORY", event)
|
|
1196
1194
|
|
|
@@ -1198,7 +1196,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1198
1196
|
"""
|
|
1199
1197
|
Reports the latest latency events logged.
|
|
1200
1198
|
|
|
1201
|
-
For more information see https://redis.io/commands/latency-latest
|
|
1199
|
+
For more information, see https://redis.io/commands/latency-latest
|
|
1202
1200
|
"""
|
|
1203
1201
|
return self.execute_command("LATENCY LATEST")
|
|
1204
1202
|
|
|
@@ -1206,15 +1204,22 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1206
1204
|
"""
|
|
1207
1205
|
Resets the latency spikes time series of all, or only some, events.
|
|
1208
1206
|
|
|
1209
|
-
For more information see https://redis.io/commands/latency-reset
|
|
1207
|
+
For more information, see https://redis.io/commands/latency-reset
|
|
1210
1208
|
"""
|
|
1211
1209
|
return self.execute_command("LATENCY RESET", *events)
|
|
1212
1210
|
|
|
1213
|
-
def ping(self, **kwargs) ->
|
|
1211
|
+
def ping(self, **kwargs) -> Union[Awaitable[bool], bool]:
|
|
1214
1212
|
"""
|
|
1215
|
-
Ping the Redis server
|
|
1213
|
+
Ping the Redis server to test connectivity.
|
|
1214
|
+
|
|
1215
|
+
Sends a PING command to the Redis server and returns True if the server
|
|
1216
|
+
responds with "PONG".
|
|
1216
1217
|
|
|
1217
|
-
|
|
1218
|
+
This command is useful for:
|
|
1219
|
+
- Testing whether a connection is still alive
|
|
1220
|
+
- Verifying the server's ability to serve data
|
|
1221
|
+
|
|
1222
|
+
For more information on the underlying ping command see https://redis.io/commands/ping
|
|
1218
1223
|
"""
|
|
1219
1224
|
return self.execute_command("PING", **kwargs)
|
|
1220
1225
|
|
|
@@ -1222,7 +1227,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1222
1227
|
"""
|
|
1223
1228
|
Ask the server to close the connection.
|
|
1224
1229
|
|
|
1225
|
-
For more information see https://redis.io/commands/quit
|
|
1230
|
+
For more information, see https://redis.io/commands/quit
|
|
1226
1231
|
"""
|
|
1227
1232
|
return self.execute_command("QUIT", **kwargs)
|
|
1228
1233
|
|
|
@@ -1235,7 +1240,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1235
1240
|
NO ONE (set no replication)
|
|
1236
1241
|
host port (set to the host and port of a redis server)
|
|
1237
1242
|
|
|
1238
|
-
For more information see https://redis.io/commands/replicaof
|
|
1243
|
+
For more information, see https://redis.io/commands/replicaof
|
|
1239
1244
|
"""
|
|
1240
1245
|
return self.execute_command("REPLICAOF", *args, **kwargs)
|
|
1241
1246
|
|
|
@@ -1244,7 +1249,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1244
1249
|
Tell the Redis server to save its data to disk,
|
|
1245
1250
|
blocking until the save is complete
|
|
1246
1251
|
|
|
1247
|
-
For more information see https://redis.io/commands/save
|
|
1252
|
+
For more information, see https://redis.io/commands/save
|
|
1248
1253
|
"""
|
|
1249
1254
|
return self.execute_command("SAVE", **kwargs)
|
|
1250
1255
|
|
|
@@ -1268,7 +1273,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1268
1273
|
``force`` ignores any errors that would normally prevent the server from exiting
|
|
1269
1274
|
``abort`` cancels an ongoing shutdown and cannot be combined with other flags.
|
|
1270
1275
|
|
|
1271
|
-
For more information see https://redis.io/commands/shutdown
|
|
1276
|
+
For more information, see https://redis.io/commands/shutdown
|
|
1272
1277
|
"""
|
|
1273
1278
|
if save and nosave:
|
|
1274
1279
|
raise DataError("SHUTDOWN save and nosave cannot both be set")
|
|
@@ -1298,7 +1303,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1298
1303
|
by the ``host`` and ``port``. If called without arguments, the
|
|
1299
1304
|
instance is promoted to a master instead.
|
|
1300
1305
|
|
|
1301
|
-
For more information see https://redis.io/commands/slaveof
|
|
1306
|
+
For more information, see https://redis.io/commands/slaveof
|
|
1302
1307
|
"""
|
|
1303
1308
|
if host is None and port is None:
|
|
1304
1309
|
return self.execute_command("SLAVEOF", b"NO", b"ONE", **kwargs)
|
|
@@ -1309,7 +1314,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1309
1314
|
Get the entries from the slowlog. If ``num`` is specified, get the
|
|
1310
1315
|
most recent ``num`` items.
|
|
1311
1316
|
|
|
1312
|
-
For more information see https://redis.io/commands/slowlog-get
|
|
1317
|
+
For more information, see https://redis.io/commands/slowlog-get
|
|
1313
1318
|
"""
|
|
1314
1319
|
from redis.client import NEVER_DECODE
|
|
1315
1320
|
|
|
@@ -1325,7 +1330,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1325
1330
|
"""
|
|
1326
1331
|
Get the number of items in the slowlog
|
|
1327
1332
|
|
|
1328
|
-
For more information see https://redis.io/commands/slowlog-len
|
|
1333
|
+
For more information, see https://redis.io/commands/slowlog-len
|
|
1329
1334
|
"""
|
|
1330
1335
|
return self.execute_command("SLOWLOG LEN", **kwargs)
|
|
1331
1336
|
|
|
@@ -1333,7 +1338,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1333
1338
|
"""
|
|
1334
1339
|
Remove all items in the slowlog
|
|
1335
1340
|
|
|
1336
|
-
For more information see https://redis.io/commands/slowlog-reset
|
|
1341
|
+
For more information, see https://redis.io/commands/slowlog-reset
|
|
1337
1342
|
"""
|
|
1338
1343
|
return self.execute_command("SLOWLOG RESET", **kwargs)
|
|
1339
1344
|
|
|
@@ -1342,7 +1347,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1342
1347
|
Returns the server time as a 2-item tuple of ints:
|
|
1343
1348
|
(seconds since epoch, microseconds into this second).
|
|
1344
1349
|
|
|
1345
|
-
For more information see https://redis.io/commands/time
|
|
1350
|
+
For more information, see https://redis.io/commands/time
|
|
1346
1351
|
"""
|
|
1347
1352
|
return self.execute_command("TIME", **kwargs)
|
|
1348
1353
|
|
|
@@ -1353,7 +1358,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1353
1358
|
we finally have at least ``num_replicas``, or when the ``timeout`` was
|
|
1354
1359
|
reached.
|
|
1355
1360
|
|
|
1356
|
-
For more information see https://redis.io/commands/wait
|
|
1361
|
+
For more information, see https://redis.io/commands/wait
|
|
1357
1362
|
"""
|
|
1358
1363
|
return self.execute_command("WAIT", num_replicas, timeout, **kwargs)
|
|
1359
1364
|
|
|
@@ -1366,7 +1371,7 @@ class ManagementCommands(CommandsProtocol):
|
|
|
1366
1371
|
to the AOF of the local Redis and/or at least the specified number
|
|
1367
1372
|
of replicas.
|
|
1368
1373
|
|
|
1369
|
-
For more information see https://redis.io/commands/waitaof
|
|
1374
|
+
For more information, see https://redis.io/commands/waitaof
|
|
1370
1375
|
"""
|
|
1371
1376
|
return self.execute_command(
|
|
1372
1377
|
"WAITAOF", num_local, num_replicas, timeout, **kwargs
|
|
@@ -1419,7 +1424,7 @@ class AsyncManagementCommands(ManagementCommands):
|
|
|
1419
1424
|
configured. If the "nosave" option is set, no data flush will be
|
|
1420
1425
|
attempted. The "save" and "nosave" options cannot both be set.
|
|
1421
1426
|
|
|
1422
|
-
For more information see https://redis.io/commands/shutdown
|
|
1427
|
+
For more information, see https://redis.io/commands/shutdown
|
|
1423
1428
|
"""
|
|
1424
1429
|
if save and nosave:
|
|
1425
1430
|
raise DataError("SHUTDOWN save and nosave cannot both be set")
|
|
@@ -1565,7 +1570,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1565
1570
|
doesn't already exist, create it with a value of ``value``.
|
|
1566
1571
|
Returns the new length of the value at ``key``.
|
|
1567
1572
|
|
|
1568
|
-
For more information see https://redis.io/commands/append
|
|
1573
|
+
For more information, see https://redis.io/commands/append
|
|
1569
1574
|
"""
|
|
1570
1575
|
return self.execute_command("APPEND", key, value)
|
|
1571
1576
|
|
|
@@ -1580,7 +1585,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1580
1585
|
Returns the count of set bits in the value of ``key``. Optional
|
|
1581
1586
|
``start`` and ``end`` parameters indicate which bytes to consider
|
|
1582
1587
|
|
|
1583
|
-
For more information see https://redis.io/commands/bitcount
|
|
1588
|
+
For more information, see https://redis.io/commands/bitcount
|
|
1584
1589
|
"""
|
|
1585
1590
|
params = [key]
|
|
1586
1591
|
if start is not None and end is not None:
|
|
@@ -1601,7 +1606,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1601
1606
|
Return a BitFieldOperation instance to conveniently construct one or
|
|
1602
1607
|
more bitfield operations on ``key``.
|
|
1603
1608
|
|
|
1604
|
-
For more information see https://redis.io/commands/bitfield
|
|
1609
|
+
For more information, see https://redis.io/commands/bitfield
|
|
1605
1610
|
"""
|
|
1606
1611
|
return BitFieldOperation(self, key, default_overflow=default_overflow)
|
|
1607
1612
|
|
|
@@ -1619,7 +1624,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1619
1624
|
encoding/offset pairs in optional list ``items``
|
|
1620
1625
|
Read-only variant of the BITFIELD command.
|
|
1621
1626
|
|
|
1622
|
-
For more information see https://redis.io/commands/bitfield_ro
|
|
1627
|
+
For more information, see https://redis.io/commands/bitfield_ro
|
|
1623
1628
|
"""
|
|
1624
1629
|
params = [key, "GET", encoding, offset]
|
|
1625
1630
|
|
|
@@ -1633,7 +1638,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1633
1638
|
Perform a bitwise operation using ``operation`` between ``keys`` and
|
|
1634
1639
|
store the result in ``dest``.
|
|
1635
1640
|
|
|
1636
|
-
For more information see https://redis.io/commands/bitop
|
|
1641
|
+
For more information, see https://redis.io/commands/bitop
|
|
1637
1642
|
"""
|
|
1638
1643
|
return self.execute_command("BITOP", operation, dest, *keys)
|
|
1639
1644
|
|
|
@@ -1651,7 +1656,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1651
1656
|
as a range of bytes and not a range of bits, so start=0 and end=2
|
|
1652
1657
|
means to look at the first three bytes.
|
|
1653
1658
|
|
|
1654
|
-
For more information see https://redis.io/commands/bitpos
|
|
1659
|
+
For more information, see https://redis.io/commands/bitpos
|
|
1655
1660
|
"""
|
|
1656
1661
|
if bit not in (0, 1):
|
|
1657
1662
|
raise DataError("bit must be 0 or 1")
|
|
@@ -1685,7 +1690,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1685
1690
|
copying the value to it. By default, the value is not copied if
|
|
1686
1691
|
the ``destination`` key already exists.
|
|
1687
1692
|
|
|
1688
|
-
For more information see https://redis.io/commands/copy
|
|
1693
|
+
For more information, see https://redis.io/commands/copy
|
|
1689
1694
|
"""
|
|
1690
1695
|
params = [source, destination]
|
|
1691
1696
|
if destination_db is not None:
|
|
@@ -1699,7 +1704,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1699
1704
|
Decrements the value of ``key`` by ``amount``. If no key exists,
|
|
1700
1705
|
the value will be initialized as 0 - ``amount``
|
|
1701
1706
|
|
|
1702
|
-
For more information see https://redis.io/commands/decrby
|
|
1707
|
+
For more information, see https://redis.io/commands/decrby
|
|
1703
1708
|
"""
|
|
1704
1709
|
return self.execute_command("DECRBY", name, amount)
|
|
1705
1710
|
|
|
@@ -1719,7 +1724,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1719
1724
|
Return a serialized version of the value stored at the specified key.
|
|
1720
1725
|
If key does not exist a nil bulk reply is returned.
|
|
1721
1726
|
|
|
1722
|
-
For more information see https://redis.io/commands/dump
|
|
1727
|
+
For more information, see https://redis.io/commands/dump
|
|
1723
1728
|
"""
|
|
1724
1729
|
from redis.client import NEVER_DECODE
|
|
1725
1730
|
|
|
@@ -1731,7 +1736,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1731
1736
|
"""
|
|
1732
1737
|
Returns the number of ``names`` that exist
|
|
1733
1738
|
|
|
1734
|
-
For more information see https://redis.io/commands/exists
|
|
1739
|
+
For more information, see https://redis.io/commands/exists
|
|
1735
1740
|
"""
|
|
1736
1741
|
return self.execute_command("EXISTS", *names, keys=names)
|
|
1737
1742
|
|
|
@@ -1757,7 +1762,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1757
1762
|
GT -> Set expiry only when the new expiry is greater than current one
|
|
1758
1763
|
LT -> Set expiry only when the new expiry is less than current one
|
|
1759
1764
|
|
|
1760
|
-
For more information see https://redis.io/commands/expire
|
|
1765
|
+
For more information, see https://redis.io/commands/expire
|
|
1761
1766
|
"""
|
|
1762
1767
|
if isinstance(time, datetime.timedelta):
|
|
1763
1768
|
time = int(time.total_seconds())
|
|
@@ -1794,7 +1799,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1794
1799
|
-> GT -- Set expiry only when the new expiry is greater than current one
|
|
1795
1800
|
-> LT -- Set expiry only when the new expiry is less than current one
|
|
1796
1801
|
|
|
1797
|
-
For more information see https://redis.io/commands/expireat
|
|
1802
|
+
For more information, see https://redis.io/commands/expireat
|
|
1798
1803
|
"""
|
|
1799
1804
|
if isinstance(when, datetime.datetime):
|
|
1800
1805
|
when = int(when.timestamp())
|
|
@@ -1816,7 +1821,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1816
1821
|
Returns the absolute Unix timestamp (since January 1, 1970) in seconds
|
|
1817
1822
|
at which the given key will expire.
|
|
1818
1823
|
|
|
1819
|
-
For more information see https://redis.io/commands/expiretime
|
|
1824
|
+
For more information, see https://redis.io/commands/expiretime
|
|
1820
1825
|
"""
|
|
1821
1826
|
return self.execute_command("EXPIRETIME", key)
|
|
1822
1827
|
|
|
@@ -1824,7 +1829,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1824
1829
|
"""
|
|
1825
1830
|
Return the value at key ``name``, or None if the key doesn't exist
|
|
1826
1831
|
|
|
1827
|
-
For more information see https://redis.io/commands/get
|
|
1832
|
+
For more information, see https://redis.io/commands/get
|
|
1828
1833
|
"""
|
|
1829
1834
|
return self.execute_command("GET", name, keys=[name])
|
|
1830
1835
|
|
|
@@ -1835,7 +1840,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1835
1840
|
the key on success (if and only if the key's value type
|
|
1836
1841
|
is a string).
|
|
1837
1842
|
|
|
1838
|
-
For more information see https://redis.io/commands/getdel
|
|
1843
|
+
For more information, see https://redis.io/commands/getdel
|
|
1839
1844
|
"""
|
|
1840
1845
|
return self.execute_command("GETDEL", name)
|
|
1841
1846
|
|
|
@@ -1866,7 +1871,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1866
1871
|
|
|
1867
1872
|
``persist`` remove the time to live associated with ``name``.
|
|
1868
1873
|
|
|
1869
|
-
For more information see https://redis.io/commands/getex
|
|
1874
|
+
For more information, see https://redis.io/commands/getex
|
|
1870
1875
|
"""
|
|
1871
1876
|
opset = {ex, px, exat, pxat}
|
|
1872
1877
|
if len(opset) > 2 or len(opset) > 1 and persist:
|
|
@@ -1896,7 +1901,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1896
1901
|
"""
|
|
1897
1902
|
Returns an integer indicating the value of ``offset`` in ``name``
|
|
1898
1903
|
|
|
1899
|
-
For more information see https://redis.io/commands/getbit
|
|
1904
|
+
For more information, see https://redis.io/commands/getbit
|
|
1900
1905
|
"""
|
|
1901
1906
|
return self.execute_command("GETBIT", name, offset, keys=[name])
|
|
1902
1907
|
|
|
@@ -1905,7 +1910,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1905
1910
|
Returns the substring of the string value stored at ``key``,
|
|
1906
1911
|
determined by the offsets ``start`` and ``end`` (both are inclusive)
|
|
1907
1912
|
|
|
1908
|
-
For more information see https://redis.io/commands/getrange
|
|
1913
|
+
For more information, see https://redis.io/commands/getrange
|
|
1909
1914
|
"""
|
|
1910
1915
|
return self.execute_command("GETRANGE", key, start, end, keys=[key])
|
|
1911
1916
|
|
|
@@ -1917,7 +1922,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1917
1922
|
As per Redis 6.2, GETSET is considered deprecated.
|
|
1918
1923
|
Please use SET with GET parameter in new code.
|
|
1919
1924
|
|
|
1920
|
-
For more information see https://redis.io/commands/getset
|
|
1925
|
+
For more information, see https://redis.io/commands/getset
|
|
1921
1926
|
"""
|
|
1922
1927
|
return self.execute_command("GETSET", name, value)
|
|
1923
1928
|
|
|
@@ -1926,7 +1931,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1926
1931
|
Increments the value of ``key`` by ``amount``. If no key exists,
|
|
1927
1932
|
the value will be initialized as ``amount``
|
|
1928
1933
|
|
|
1929
|
-
For more information see https://redis.io/commands/incrby
|
|
1934
|
+
For more information, see https://redis.io/commands/incrby
|
|
1930
1935
|
"""
|
|
1931
1936
|
return self.execute_command("INCRBY", name, amount)
|
|
1932
1937
|
|
|
@@ -1937,7 +1942,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1937
1942
|
Increments the value at key ``name`` by floating ``amount``.
|
|
1938
1943
|
If no key exists, the value will be initialized as ``amount``
|
|
1939
1944
|
|
|
1940
|
-
For more information see https://redis.io/commands/incrbyfloat
|
|
1945
|
+
For more information, see https://redis.io/commands/incrbyfloat
|
|
1941
1946
|
"""
|
|
1942
1947
|
return self.execute_command("INCRBYFLOAT", name, amount)
|
|
1943
1948
|
|
|
@@ -1945,7 +1950,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1945
1950
|
"""
|
|
1946
1951
|
Returns a list of keys matching ``pattern``
|
|
1947
1952
|
|
|
1948
|
-
For more information see https://redis.io/commands/keys
|
|
1953
|
+
For more information, see https://redis.io/commands/keys
|
|
1949
1954
|
"""
|
|
1950
1955
|
return self.execute_command("KEYS", pattern, **kwargs)
|
|
1951
1956
|
|
|
@@ -1957,7 +1962,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1957
1962
|
pushing it as the first/last element on the destination list.
|
|
1958
1963
|
Returns the element being popped and pushed.
|
|
1959
1964
|
|
|
1960
|
-
For more information see https://redis.io/commands/lmove
|
|
1965
|
+
For more information, see https://redis.io/commands/lmove
|
|
1961
1966
|
"""
|
|
1962
1967
|
params = [first_list, second_list, src, dest]
|
|
1963
1968
|
return self.execute_command("LMOVE", *params)
|
|
@@ -1973,7 +1978,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1973
1978
|
"""
|
|
1974
1979
|
Blocking version of lmove.
|
|
1975
1980
|
|
|
1976
|
-
For more information see https://redis.io/commands/blmove
|
|
1981
|
+
For more information, see https://redis.io/commands/blmove
|
|
1977
1982
|
"""
|
|
1978
1983
|
params = [first_list, second_list, src, dest, timeout]
|
|
1979
1984
|
return self.execute_command("BLMOVE", *params)
|
|
@@ -1982,7 +1987,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1982
1987
|
"""
|
|
1983
1988
|
Returns a list of values ordered identically to ``keys``
|
|
1984
1989
|
|
|
1985
|
-
For more information see https://redis.io/commands/mget
|
|
1990
|
+
For more information, see https://redis.io/commands/mget
|
|
1986
1991
|
"""
|
|
1987
1992
|
from redis.client import EMPTY_RESPONSE
|
|
1988
1993
|
|
|
@@ -1999,7 +2004,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
1999
2004
|
key/value pairs. Both keys and values should be strings or types that
|
|
2000
2005
|
can be cast to a string via str().
|
|
2001
2006
|
|
|
2002
|
-
For more information see https://redis.io/commands/mset
|
|
2007
|
+
For more information, see https://redis.io/commands/mset
|
|
2003
2008
|
"""
|
|
2004
2009
|
items = []
|
|
2005
2010
|
for pair in mapping.items():
|
|
@@ -2013,7 +2018,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2013
2018
|
should be strings or types that can be cast to a string via str().
|
|
2014
2019
|
Returns a boolean indicating if the operation was successful.
|
|
2015
2020
|
|
|
2016
|
-
For more information see https://redis.io/commands/msetnx
|
|
2021
|
+
For more information, see https://redis.io/commands/msetnx
|
|
2017
2022
|
"""
|
|
2018
2023
|
items = []
|
|
2019
2024
|
for pair in mapping.items():
|
|
@@ -2024,7 +2029,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2024
2029
|
"""
|
|
2025
2030
|
Moves the key ``name`` to a different Redis database ``db``
|
|
2026
2031
|
|
|
2027
|
-
For more information see https://redis.io/commands/move
|
|
2032
|
+
For more information, see https://redis.io/commands/move
|
|
2028
2033
|
"""
|
|
2029
2034
|
return self.execute_command("MOVE", name, db)
|
|
2030
2035
|
|
|
@@ -2032,7 +2037,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2032
2037
|
"""
|
|
2033
2038
|
Removes an expiration on ``name``
|
|
2034
2039
|
|
|
2035
|
-
For more information see https://redis.io/commands/persist
|
|
2040
|
+
For more information, see https://redis.io/commands/persist
|
|
2036
2041
|
"""
|
|
2037
2042
|
return self.execute_command("PERSIST", name)
|
|
2038
2043
|
|
|
@@ -2056,7 +2061,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2056
2061
|
GT -> Set expiry only when the new expiry is greater than current one
|
|
2057
2062
|
LT -> Set expiry only when the new expiry is less than current one
|
|
2058
2063
|
|
|
2059
|
-
For more information see https://redis.io/commands/pexpire
|
|
2064
|
+
For more information, see https://redis.io/commands/pexpire
|
|
2060
2065
|
"""
|
|
2061
2066
|
if isinstance(time, datetime.timedelta):
|
|
2062
2067
|
time = int(time.total_seconds() * 1000)
|
|
@@ -2092,7 +2097,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2092
2097
|
GT -> Set expiry only when the new expiry is greater than current one
|
|
2093
2098
|
LT -> Set expiry only when the new expiry is less than current one
|
|
2094
2099
|
|
|
2095
|
-
For more information see https://redis.io/commands/pexpireat
|
|
2100
|
+
For more information, see https://redis.io/commands/pexpireat
|
|
2096
2101
|
"""
|
|
2097
2102
|
if isinstance(when, datetime.datetime):
|
|
2098
2103
|
when = int(when.timestamp() * 1000)
|
|
@@ -2112,7 +2117,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2112
2117
|
Returns the absolute Unix timestamp (since January 1, 1970) in milliseconds
|
|
2113
2118
|
at which the given key will expire.
|
|
2114
2119
|
|
|
2115
|
-
For more information see https://redis.io/commands/pexpiretime
|
|
2120
|
+
For more information, see https://redis.io/commands/pexpiretime
|
|
2116
2121
|
"""
|
|
2117
2122
|
return self.execute_command("PEXPIRETIME", key)
|
|
2118
2123
|
|
|
@@ -2122,7 +2127,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2122
2127
|
milliseconds. ``time_ms`` can be represented by an integer or a Python
|
|
2123
2128
|
timedelta object
|
|
2124
2129
|
|
|
2125
|
-
For more information see https://redis.io/commands/psetex
|
|
2130
|
+
For more information, see https://redis.io/commands/psetex
|
|
2126
2131
|
"""
|
|
2127
2132
|
if isinstance(time_ms, datetime.timedelta):
|
|
2128
2133
|
time_ms = int(time_ms.total_seconds() * 1000)
|
|
@@ -2132,7 +2137,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2132
2137
|
"""
|
|
2133
2138
|
Returns the number of milliseconds until the key ``name`` will expire
|
|
2134
2139
|
|
|
2135
|
-
For more information see https://redis.io/commands/pttl
|
|
2140
|
+
For more information, see https://redis.io/commands/pttl
|
|
2136
2141
|
"""
|
|
2137
2142
|
return self.execute_command("PTTL", name)
|
|
2138
2143
|
|
|
@@ -2150,7 +2155,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2150
2155
|
withvalues: The optional WITHVALUES modifier changes the reply so it
|
|
2151
2156
|
includes the respective values of the randomly selected hash fields.
|
|
2152
2157
|
|
|
2153
|
-
For more information see https://redis.io/commands/hrandfield
|
|
2158
|
+
For more information, see https://redis.io/commands/hrandfield
|
|
2154
2159
|
"""
|
|
2155
2160
|
params = []
|
|
2156
2161
|
if count is not None:
|
|
@@ -2164,7 +2169,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2164
2169
|
"""
|
|
2165
2170
|
Returns the name of a random key
|
|
2166
2171
|
|
|
2167
|
-
For more information see https://redis.io/commands/randomkey
|
|
2172
|
+
For more information, see https://redis.io/commands/randomkey
|
|
2168
2173
|
"""
|
|
2169
2174
|
return self.execute_command("RANDOMKEY", **kwargs)
|
|
2170
2175
|
|
|
@@ -2172,7 +2177,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2172
2177
|
"""
|
|
2173
2178
|
Rename key ``src`` to ``dst``
|
|
2174
2179
|
|
|
2175
|
-
For more information see https://redis.io/commands/rename
|
|
2180
|
+
For more information, see https://redis.io/commands/rename
|
|
2176
2181
|
"""
|
|
2177
2182
|
return self.execute_command("RENAME", src, dst)
|
|
2178
2183
|
|
|
@@ -2180,7 +2185,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2180
2185
|
"""
|
|
2181
2186
|
Rename key ``src`` to ``dst`` if ``dst`` doesn't already exist
|
|
2182
2187
|
|
|
2183
|
-
For more information see https://redis.io/commands/renamenx
|
|
2188
|
+
For more information, see https://redis.io/commands/renamenx
|
|
2184
2189
|
"""
|
|
2185
2190
|
return self.execute_command("RENAMENX", src, dst)
|
|
2186
2191
|
|
|
@@ -2211,7 +2216,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2211
2216
|
``frequency`` Used for eviction, this is the frequency counter of
|
|
2212
2217
|
the object stored at the key, prior to execution.
|
|
2213
2218
|
|
|
2214
|
-
For more information see https://redis.io/commands/restore
|
|
2219
|
+
For more information, see https://redis.io/commands/restore
|
|
2215
2220
|
"""
|
|
2216
2221
|
params = [name, ttl, value]
|
|
2217
2222
|
if replace:
|
|
@@ -2273,7 +2278,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2273
2278
|
``pxat`` sets an expire flag on key ``name`` for ``ex`` milliseconds,
|
|
2274
2279
|
specified in unix time.
|
|
2275
2280
|
|
|
2276
|
-
For more information see https://redis.io/commands/set
|
|
2281
|
+
For more information, see https://redis.io/commands/set
|
|
2277
2282
|
"""
|
|
2278
2283
|
opset = {ex, px, exat, pxat}
|
|
2279
2284
|
if len(opset) > 2 or len(opset) > 1 and keepttl:
|
|
@@ -2312,7 +2317,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2312
2317
|
Flag the ``offset`` in ``name`` as ``value``. Returns an integer
|
|
2313
2318
|
indicating the previous value of ``offset``.
|
|
2314
2319
|
|
|
2315
|
-
For more information see https://redis.io/commands/setbit
|
|
2320
|
+
For more information, see https://redis.io/commands/setbit
|
|
2316
2321
|
"""
|
|
2317
2322
|
value = value and 1 or 0
|
|
2318
2323
|
return self.execute_command("SETBIT", name, offset, value)
|
|
@@ -2323,7 +2328,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2323
2328
|
seconds. ``time`` can be represented by an integer or a Python
|
|
2324
2329
|
timedelta object.
|
|
2325
2330
|
|
|
2326
|
-
For more information see https://redis.io/commands/setex
|
|
2331
|
+
For more information, see https://redis.io/commands/setex
|
|
2327
2332
|
"""
|
|
2328
2333
|
if isinstance(time, datetime.timedelta):
|
|
2329
2334
|
time = int(time.total_seconds())
|
|
@@ -2333,7 +2338,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2333
2338
|
"""
|
|
2334
2339
|
Set the value of key ``name`` to ``value`` if key doesn't exist
|
|
2335
2340
|
|
|
2336
|
-
For more information see https://redis.io/commands/setnx
|
|
2341
|
+
For more information, see https://redis.io/commands/setnx
|
|
2337
2342
|
"""
|
|
2338
2343
|
return self.execute_command("SETNX", name, value)
|
|
2339
2344
|
|
|
@@ -2348,7 +2353,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2348
2353
|
|
|
2349
2354
|
Returns the length of the new string.
|
|
2350
2355
|
|
|
2351
|
-
For more information see https://redis.io/commands/setrange
|
|
2356
|
+
For more information, see https://redis.io/commands/setrange
|
|
2352
2357
|
"""
|
|
2353
2358
|
return self.execute_command("SETRANGE", name, offset, value)
|
|
2354
2359
|
|
|
@@ -2381,7 +2386,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2381
2386
|
``withmatchlen`` Returns the matches with the len of the match.
|
|
2382
2387
|
Can be provided only when ``idx`` set to True.
|
|
2383
2388
|
|
|
2384
|
-
For more information see https://redis.io/commands/stralgo
|
|
2389
|
+
For more information, see https://redis.io/commands/stralgo
|
|
2385
2390
|
"""
|
|
2386
2391
|
# check validity
|
|
2387
2392
|
supported_algo = ["LCS"]
|
|
@@ -2420,7 +2425,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2420
2425
|
"""
|
|
2421
2426
|
Return the number of bytes stored in the value of ``name``
|
|
2422
2427
|
|
|
2423
|
-
For more information see https://redis.io/commands/strlen
|
|
2428
|
+
For more information, see https://redis.io/commands/strlen
|
|
2424
2429
|
"""
|
|
2425
2430
|
return self.execute_command("STRLEN", name, keys=[name])
|
|
2426
2431
|
|
|
@@ -2436,7 +2441,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2436
2441
|
Alters the last access time of a key(s) ``*args``. A key is ignored
|
|
2437
2442
|
if it does not exist.
|
|
2438
2443
|
|
|
2439
|
-
For more information see https://redis.io/commands/touch
|
|
2444
|
+
For more information, see https://redis.io/commands/touch
|
|
2440
2445
|
"""
|
|
2441
2446
|
return self.execute_command("TOUCH", *args)
|
|
2442
2447
|
|
|
@@ -2444,7 +2449,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2444
2449
|
"""
|
|
2445
2450
|
Returns the number of seconds until the key ``name`` will expire
|
|
2446
2451
|
|
|
2447
|
-
For more information see https://redis.io/commands/ttl
|
|
2452
|
+
For more information, see https://redis.io/commands/ttl
|
|
2448
2453
|
"""
|
|
2449
2454
|
return self.execute_command("TTL", name)
|
|
2450
2455
|
|
|
@@ -2452,7 +2457,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2452
2457
|
"""
|
|
2453
2458
|
Returns the type of key ``name``
|
|
2454
2459
|
|
|
2455
|
-
For more information see https://redis.io/commands/type
|
|
2460
|
+
For more information, see https://redis.io/commands/type
|
|
2456
2461
|
"""
|
|
2457
2462
|
return self.execute_command("TYPE", name, keys=[name])
|
|
2458
2463
|
|
|
@@ -2460,7 +2465,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2460
2465
|
"""
|
|
2461
2466
|
Watches the values at keys ``names``, or None if the key doesn't exist
|
|
2462
2467
|
|
|
2463
|
-
For more information see https://redis.io/commands/watch
|
|
2468
|
+
For more information, see https://redis.io/commands/watch
|
|
2464
2469
|
"""
|
|
2465
2470
|
warnings.warn(DeprecationWarning("Call WATCH from a Pipeline object"))
|
|
2466
2471
|
|
|
@@ -2468,7 +2473,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2468
2473
|
"""
|
|
2469
2474
|
Unwatches all previously watched keys for a transaction
|
|
2470
2475
|
|
|
2471
|
-
For more information see https://redis.io/commands/unwatch
|
|
2476
|
+
For more information, see https://redis.io/commands/unwatch
|
|
2472
2477
|
"""
|
|
2473
2478
|
warnings.warn(DeprecationWarning("Call UNWATCH from a Pipeline object"))
|
|
2474
2479
|
|
|
@@ -2476,7 +2481,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2476
2481
|
"""
|
|
2477
2482
|
Unlink one or more keys specified by ``names``
|
|
2478
2483
|
|
|
2479
|
-
For more information see https://redis.io/commands/unlink
|
|
2484
|
+
For more information, see https://redis.io/commands/unlink
|
|
2480
2485
|
"""
|
|
2481
2486
|
return self.execute_command("UNLINK", *names)
|
|
2482
2487
|
|
|
@@ -2496,7 +2501,7 @@ class BasicKeyCommands(CommandsProtocol):
|
|
|
2496
2501
|
``minmatchlen`` restrict the list of matches to the ones of
|
|
2497
2502
|
the given ``minmatchlen``.
|
|
2498
2503
|
If ``withmatchlen`` the length of the match also will be returned.
|
|
2499
|
-
For more information see https://redis.io/commands/lcs
|
|
2504
|
+
For more information, see https://redis.io/commands/lcs
|
|
2500
2505
|
"""
|
|
2501
2506
|
pieces = [key1, key2]
|
|
2502
2507
|
if len:
|
|
@@ -2549,7 +2554,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2549
2554
|
|
|
2550
2555
|
If timeout is 0, then block indefinitely.
|
|
2551
2556
|
|
|
2552
|
-
For more information see https://redis.io/commands/blpop
|
|
2557
|
+
For more information, see https://redis.io/commands/blpop
|
|
2553
2558
|
"""
|
|
2554
2559
|
if timeout is None:
|
|
2555
2560
|
timeout = 0
|
|
@@ -2570,7 +2575,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2570
2575
|
|
|
2571
2576
|
If timeout is 0, then block indefinitely.
|
|
2572
2577
|
|
|
2573
|
-
For more information see https://redis.io/commands/brpop
|
|
2578
|
+
For more information, see https://redis.io/commands/brpop
|
|
2574
2579
|
"""
|
|
2575
2580
|
if timeout is None:
|
|
2576
2581
|
timeout = 0
|
|
@@ -2589,7 +2594,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2589
2594
|
seconds elapse, whichever is first. A ``timeout`` value of 0 blocks
|
|
2590
2595
|
forever.
|
|
2591
2596
|
|
|
2592
|
-
For more information see https://redis.io/commands/brpoplpush
|
|
2597
|
+
For more information, see https://redis.io/commands/brpoplpush
|
|
2593
2598
|
"""
|
|
2594
2599
|
if timeout is None:
|
|
2595
2600
|
timeout = 0
|
|
@@ -2599,7 +2604,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2599
2604
|
self,
|
|
2600
2605
|
timeout: float,
|
|
2601
2606
|
numkeys: int,
|
|
2602
|
-
*args:
|
|
2607
|
+
*args: str,
|
|
2603
2608
|
direction: str,
|
|
2604
2609
|
count: Optional[int] = 1,
|
|
2605
2610
|
) -> Optional[list]:
|
|
@@ -2610,16 +2615,16 @@ class ListCommands(CommandsProtocol):
|
|
|
2610
2615
|
When all lists are empty this command blocks the connection until another
|
|
2611
2616
|
client pushes to it or until the timeout, timeout of 0 blocks indefinitely
|
|
2612
2617
|
|
|
2613
|
-
For more information see https://redis.io/commands/blmpop
|
|
2618
|
+
For more information, see https://redis.io/commands/blmpop
|
|
2614
2619
|
"""
|
|
2615
|
-
|
|
2620
|
+
cmd_args = [timeout, numkeys, *args, direction, "COUNT", count]
|
|
2616
2621
|
|
|
2617
|
-
return self.execute_command("BLMPOP", *
|
|
2622
|
+
return self.execute_command("BLMPOP", *cmd_args)
|
|
2618
2623
|
|
|
2619
2624
|
def lmpop(
|
|
2620
2625
|
self,
|
|
2621
2626
|
num_keys: int,
|
|
2622
|
-
*args:
|
|
2627
|
+
*args: str,
|
|
2623
2628
|
direction: str,
|
|
2624
2629
|
count: Optional[int] = 1,
|
|
2625
2630
|
) -> Union[Awaitable[list], list]:
|
|
@@ -2627,13 +2632,13 @@ class ListCommands(CommandsProtocol):
|
|
|
2627
2632
|
Pop ``count`` values (default 1) first non-empty list key from the list
|
|
2628
2633
|
of args provided key names.
|
|
2629
2634
|
|
|
2630
|
-
For more information see https://redis.io/commands/lmpop
|
|
2635
|
+
For more information, see https://redis.io/commands/lmpop
|
|
2631
2636
|
"""
|
|
2632
|
-
|
|
2637
|
+
cmd_args = [num_keys] + list(args) + [direction]
|
|
2633
2638
|
if count != 1:
|
|
2634
|
-
|
|
2639
|
+
cmd_args.extend(["COUNT", count])
|
|
2635
2640
|
|
|
2636
|
-
return self.execute_command("LMPOP", *
|
|
2641
|
+
return self.execute_command("LMPOP", *cmd_args)
|
|
2637
2642
|
|
|
2638
2643
|
def lindex(
|
|
2639
2644
|
self, name: str, index: int
|
|
@@ -2644,7 +2649,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2644
2649
|
Negative indexes are supported and will return an item at the
|
|
2645
2650
|
end of the list
|
|
2646
2651
|
|
|
2647
|
-
For more information see https://redis.io/commands/lindex
|
|
2652
|
+
For more information, see https://redis.io/commands/lindex
|
|
2648
2653
|
"""
|
|
2649
2654
|
return self.execute_command("LINDEX", name, index, keys=[name])
|
|
2650
2655
|
|
|
@@ -2658,7 +2663,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2658
2663
|
Returns the new length of the list on success or -1 if ``refvalue``
|
|
2659
2664
|
is not in the list.
|
|
2660
2665
|
|
|
2661
|
-
For more information see https://redis.io/commands/linsert
|
|
2666
|
+
For more information, see https://redis.io/commands/linsert
|
|
2662
2667
|
"""
|
|
2663
2668
|
return self.execute_command("LINSERT", name, where, refvalue, value)
|
|
2664
2669
|
|
|
@@ -2666,7 +2671,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2666
2671
|
"""
|
|
2667
2672
|
Return the length of the list ``name``
|
|
2668
2673
|
|
|
2669
|
-
For more information see https://redis.io/commands/llen
|
|
2674
|
+
For more information, see https://redis.io/commands/llen
|
|
2670
2675
|
"""
|
|
2671
2676
|
return self.execute_command("LLEN", name, keys=[name])
|
|
2672
2677
|
|
|
@@ -2682,7 +2687,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2682
2687
|
the list. When provided with the optional ``count`` argument, the reply
|
|
2683
2688
|
will consist of up to count elements, depending on the list's length.
|
|
2684
2689
|
|
|
2685
|
-
For more information see https://redis.io/commands/lpop
|
|
2690
|
+
For more information, see https://redis.io/commands/lpop
|
|
2686
2691
|
"""
|
|
2687
2692
|
if count is not None:
|
|
2688
2693
|
return self.execute_command("LPOP", name, count)
|
|
@@ -2693,7 +2698,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2693
2698
|
"""
|
|
2694
2699
|
Push ``values`` onto the head of the list ``name``
|
|
2695
2700
|
|
|
2696
|
-
For more information see https://redis.io/commands/lpush
|
|
2701
|
+
For more information, see https://redis.io/commands/lpush
|
|
2697
2702
|
"""
|
|
2698
2703
|
return self.execute_command("LPUSH", name, *values)
|
|
2699
2704
|
|
|
@@ -2701,7 +2706,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2701
2706
|
"""
|
|
2702
2707
|
Push ``value`` onto the head of the list ``name`` if ``name`` exists
|
|
2703
2708
|
|
|
2704
|
-
For more information see https://redis.io/commands/lpushx
|
|
2709
|
+
For more information, see https://redis.io/commands/lpushx
|
|
2705
2710
|
"""
|
|
2706
2711
|
return self.execute_command("LPUSHX", name, *values)
|
|
2707
2712
|
|
|
@@ -2713,7 +2718,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2713
2718
|
``start`` and ``end`` can be negative numbers just like
|
|
2714
2719
|
Python slicing notation
|
|
2715
2720
|
|
|
2716
|
-
For more information see https://redis.io/commands/lrange
|
|
2721
|
+
For more information, see https://redis.io/commands/lrange
|
|
2717
2722
|
"""
|
|
2718
2723
|
return self.execute_command("LRANGE", name, start, end, keys=[name])
|
|
2719
2724
|
|
|
@@ -2727,7 +2732,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2727
2732
|
count < 0: Remove elements equal to value moving from tail to head.
|
|
2728
2733
|
count = 0: Remove all elements equal to value.
|
|
2729
2734
|
|
|
2730
|
-
For more information see https://redis.io/commands/lrem
|
|
2735
|
+
For more information, see https://redis.io/commands/lrem
|
|
2731
2736
|
"""
|
|
2732
2737
|
return self.execute_command("LREM", name, count, value)
|
|
2733
2738
|
|
|
@@ -2735,7 +2740,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2735
2740
|
"""
|
|
2736
2741
|
Set element at ``index`` of list ``name`` to ``value``
|
|
2737
2742
|
|
|
2738
|
-
For more information see https://redis.io/commands/lset
|
|
2743
|
+
For more information, see https://redis.io/commands/lset
|
|
2739
2744
|
"""
|
|
2740
2745
|
return self.execute_command("LSET", name, index, value)
|
|
2741
2746
|
|
|
@@ -2747,7 +2752,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2747
2752
|
``start`` and ``end`` can be negative numbers just like
|
|
2748
2753
|
Python slicing notation
|
|
2749
2754
|
|
|
2750
|
-
For more information see https://redis.io/commands/ltrim
|
|
2755
|
+
For more information, see https://redis.io/commands/ltrim
|
|
2751
2756
|
"""
|
|
2752
2757
|
return self.execute_command("LTRIM", name, start, end)
|
|
2753
2758
|
|
|
@@ -2763,7 +2768,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2763
2768
|
When provided with the optional ``count`` argument, the reply will
|
|
2764
2769
|
consist of up to count elements, depending on the list's length.
|
|
2765
2770
|
|
|
2766
|
-
For more information see https://redis.io/commands/rpop
|
|
2771
|
+
For more information, see https://redis.io/commands/rpop
|
|
2767
2772
|
"""
|
|
2768
2773
|
if count is not None:
|
|
2769
2774
|
return self.execute_command("RPOP", name, count)
|
|
@@ -2775,7 +2780,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2775
2780
|
RPOP a value off of the ``src`` list and atomically LPUSH it
|
|
2776
2781
|
on to the ``dst`` list. Returns the value.
|
|
2777
2782
|
|
|
2778
|
-
For more information see https://redis.io/commands/rpoplpush
|
|
2783
|
+
For more information, see https://redis.io/commands/rpoplpush
|
|
2779
2784
|
"""
|
|
2780
2785
|
return self.execute_command("RPOPLPUSH", src, dst)
|
|
2781
2786
|
|
|
@@ -2783,7 +2788,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2783
2788
|
"""
|
|
2784
2789
|
Push ``values`` onto the tail of the list ``name``
|
|
2785
2790
|
|
|
2786
|
-
For more information see https://redis.io/commands/rpush
|
|
2791
|
+
For more information, see https://redis.io/commands/rpush
|
|
2787
2792
|
"""
|
|
2788
2793
|
return self.execute_command("RPUSH", name, *values)
|
|
2789
2794
|
|
|
@@ -2791,7 +2796,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2791
2796
|
"""
|
|
2792
2797
|
Push ``value`` onto the tail of the list ``name`` if ``name`` exists
|
|
2793
2798
|
|
|
2794
|
-
For more information see https://redis.io/commands/rpushx
|
|
2799
|
+
For more information, see https://redis.io/commands/rpushx
|
|
2795
2800
|
"""
|
|
2796
2801
|
return self.execute_command("RPUSHX", name, *values)
|
|
2797
2802
|
|
|
@@ -2826,7 +2831,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2826
2831
|
position(s) of items within the first 1000 entries in the list.
|
|
2827
2832
|
A ``maxlen`` of 0 (the default) will scan the entire list.
|
|
2828
2833
|
|
|
2829
|
-
For more information see https://redis.io/commands/lpos
|
|
2834
|
+
For more information, see https://redis.io/commands/lpos
|
|
2830
2835
|
"""
|
|
2831
2836
|
pieces: list[EncodableT] = [name, value]
|
|
2832
2837
|
if rank is not None:
|
|
@@ -2875,7 +2880,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2875
2880
|
elements, sort will return a list of tuples, each containing the
|
|
2876
2881
|
values fetched from the arguments to ``get``.
|
|
2877
2882
|
|
|
2878
|
-
For more information see https://redis.io/commands/sort
|
|
2883
|
+
For more information, see https://redis.io/commands/sort
|
|
2879
2884
|
"""
|
|
2880
2885
|
if (start is not None and num is None) or (num is not None and start is None):
|
|
2881
2886
|
raise DataError("``start`` and ``num`` must both be specified")
|
|
@@ -2940,7 +2945,7 @@ class ListCommands(CommandsProtocol):
|
|
|
2940
2945
|
|
|
2941
2946
|
``alpha`` allows for sorting lexicographically rather than numerically
|
|
2942
2947
|
|
|
2943
|
-
For more information see https://redis.io/commands/sort_ro
|
|
2948
|
+
For more information, see https://redis.io/commands/sort_ro
|
|
2944
2949
|
"""
|
|
2945
2950
|
return self.sort(
|
|
2946
2951
|
key, start=start, num=num, by=by, get=get, desc=desc, alpha=alpha
|
|
@@ -2978,7 +2983,7 @@ class ScanCommands(CommandsProtocol):
|
|
|
2978
2983
|
HASH, LIST, SET, STREAM, STRING, ZSET
|
|
2979
2984
|
Additionally, Redis modules can expose other types as well.
|
|
2980
2985
|
|
|
2981
|
-
For more information see https://redis.io/commands/scan
|
|
2986
|
+
For more information, see https://redis.io/commands/scan
|
|
2982
2987
|
"""
|
|
2983
2988
|
pieces: list[EncodableT] = [cursor]
|
|
2984
2989
|
if match is not None:
|
|
@@ -3032,7 +3037,7 @@ class ScanCommands(CommandsProtocol):
|
|
|
3032
3037
|
|
|
3033
3038
|
``count`` allows for hint the minimum number of returns
|
|
3034
3039
|
|
|
3035
|
-
For more information see https://redis.io/commands/sscan
|
|
3040
|
+
For more information, see https://redis.io/commands/sscan
|
|
3036
3041
|
"""
|
|
3037
3042
|
pieces: list[EncodableT] = [name, cursor]
|
|
3038
3043
|
if match is not None:
|
|
@@ -3078,7 +3083,7 @@ class ScanCommands(CommandsProtocol):
|
|
|
3078
3083
|
|
|
3079
3084
|
``no_values`` indicates to return only the keys, without values.
|
|
3080
3085
|
|
|
3081
|
-
For more information see https://redis.io/commands/hscan
|
|
3086
|
+
For more information, see https://redis.io/commands/hscan
|
|
3082
3087
|
"""
|
|
3083
3088
|
pieces: list[EncodableT] = [name, cursor]
|
|
3084
3089
|
if match is not None:
|
|
@@ -3134,7 +3139,7 @@ class ScanCommands(CommandsProtocol):
|
|
|
3134
3139
|
|
|
3135
3140
|
``score_cast_func`` a callable used to cast the score return value
|
|
3136
3141
|
|
|
3137
|
-
For more information see https://redis.io/commands/zscan
|
|
3142
|
+
For more information, see https://redis.io/commands/zscan
|
|
3138
3143
|
"""
|
|
3139
3144
|
pieces = [name, cursor]
|
|
3140
3145
|
if match is not None:
|
|
@@ -3294,7 +3299,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3294
3299
|
"""
|
|
3295
3300
|
Add ``value(s)`` to set ``name``
|
|
3296
3301
|
|
|
3297
|
-
For more information see https://redis.io/commands/sadd
|
|
3302
|
+
For more information, see https://redis.io/commands/sadd
|
|
3298
3303
|
"""
|
|
3299
3304
|
return self.execute_command("SADD", name, *values)
|
|
3300
3305
|
|
|
@@ -3302,7 +3307,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3302
3307
|
"""
|
|
3303
3308
|
Return the number of elements in set ``name``
|
|
3304
3309
|
|
|
3305
|
-
For more information see https://redis.io/commands/scard
|
|
3310
|
+
For more information, see https://redis.io/commands/scard
|
|
3306
3311
|
"""
|
|
3307
3312
|
return self.execute_command("SCARD", name, keys=[name])
|
|
3308
3313
|
|
|
@@ -3310,7 +3315,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3310
3315
|
"""
|
|
3311
3316
|
Return the difference of sets specified by ``keys``
|
|
3312
3317
|
|
|
3313
|
-
For more information see https://redis.io/commands/sdiff
|
|
3318
|
+
For more information, see https://redis.io/commands/sdiff
|
|
3314
3319
|
"""
|
|
3315
3320
|
args = list_or_args(keys, args)
|
|
3316
3321
|
return self.execute_command("SDIFF", *args, keys=args)
|
|
@@ -3322,7 +3327,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3322
3327
|
Store the difference of sets specified by ``keys`` into a new
|
|
3323
3328
|
set named ``dest``. Returns the number of keys in the new set.
|
|
3324
3329
|
|
|
3325
|
-
For more information see https://redis.io/commands/sdiffstore
|
|
3330
|
+
For more information, see https://redis.io/commands/sdiffstore
|
|
3326
3331
|
"""
|
|
3327
3332
|
args = list_or_args(keys, args)
|
|
3328
3333
|
return self.execute_command("SDIFFSTORE", dest, *args)
|
|
@@ -3331,7 +3336,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3331
3336
|
"""
|
|
3332
3337
|
Return the intersection of sets specified by ``keys``
|
|
3333
3338
|
|
|
3334
|
-
For more information see https://redis.io/commands/sinter
|
|
3339
|
+
For more information, see https://redis.io/commands/sinter
|
|
3335
3340
|
"""
|
|
3336
3341
|
args = list_or_args(keys, args)
|
|
3337
3342
|
return self.execute_command("SINTER", *args, keys=args)
|
|
@@ -3346,7 +3351,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3346
3351
|
cardinality reaches limit partway through the computation, the algorithm will
|
|
3347
3352
|
exit and yield limit as the cardinality
|
|
3348
3353
|
|
|
3349
|
-
For more information see https://redis.io/commands/sintercard
|
|
3354
|
+
For more information, see https://redis.io/commands/sintercard
|
|
3350
3355
|
"""
|
|
3351
3356
|
args = [numkeys, *keys, "LIMIT", limit]
|
|
3352
3357
|
return self.execute_command("SINTERCARD", *args, keys=keys)
|
|
@@ -3358,7 +3363,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3358
3363
|
Store the intersection of sets specified by ``keys`` into a new
|
|
3359
3364
|
set named ``dest``. Returns the number of keys in the new set.
|
|
3360
3365
|
|
|
3361
|
-
For more information see https://redis.io/commands/sinterstore
|
|
3366
|
+
For more information, see https://redis.io/commands/sinterstore
|
|
3362
3367
|
"""
|
|
3363
3368
|
args = list_or_args(keys, args)
|
|
3364
3369
|
return self.execute_command("SINTERSTORE", dest, *args)
|
|
@@ -3371,7 +3376,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3371
3376
|
- 1 if the value is a member of the set.
|
|
3372
3377
|
- 0 if the value is not a member of the set or if key does not exist.
|
|
3373
3378
|
|
|
3374
|
-
For more information see https://redis.io/commands/sismember
|
|
3379
|
+
For more information, see https://redis.io/commands/sismember
|
|
3375
3380
|
"""
|
|
3376
3381
|
return self.execute_command("SISMEMBER", name, value, keys=[name])
|
|
3377
3382
|
|
|
@@ -3379,7 +3384,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3379
3384
|
"""
|
|
3380
3385
|
Return all members of the set ``name``
|
|
3381
3386
|
|
|
3382
|
-
For more information see https://redis.io/commands/smembers
|
|
3387
|
+
For more information, see https://redis.io/commands/smembers
|
|
3383
3388
|
"""
|
|
3384
3389
|
return self.execute_command("SMEMBERS", name, keys=[name])
|
|
3385
3390
|
|
|
@@ -3395,7 +3400,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3395
3400
|
- 1 if the value is a member of the set.
|
|
3396
3401
|
- 0 if the value is not a member of the set or if key does not exist.
|
|
3397
3402
|
|
|
3398
|
-
For more information see https://redis.io/commands/smismember
|
|
3403
|
+
For more information, see https://redis.io/commands/smismember
|
|
3399
3404
|
"""
|
|
3400
3405
|
args = list_or_args(values, args)
|
|
3401
3406
|
return self.execute_command("SMISMEMBER", name, *args, keys=[name])
|
|
@@ -3404,7 +3409,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3404
3409
|
"""
|
|
3405
3410
|
Move ``value`` from set ``src`` to set ``dst`` atomically
|
|
3406
3411
|
|
|
3407
|
-
For more information see https://redis.io/commands/smove
|
|
3412
|
+
For more information, see https://redis.io/commands/smove
|
|
3408
3413
|
"""
|
|
3409
3414
|
return self.execute_command("SMOVE", src, dst, value)
|
|
3410
3415
|
|
|
@@ -3412,7 +3417,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3412
3417
|
"""
|
|
3413
3418
|
Remove and return a random member of set ``name``
|
|
3414
3419
|
|
|
3415
|
-
For more information see https://redis.io/commands/spop
|
|
3420
|
+
For more information, see https://redis.io/commands/spop
|
|
3416
3421
|
"""
|
|
3417
3422
|
args = (count is not None) and [count] or []
|
|
3418
3423
|
return self.execute_command("SPOP", name, *args)
|
|
@@ -3427,7 +3432,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3427
3432
|
members of set ``name``. Note this is only available when running
|
|
3428
3433
|
Redis 2.6+.
|
|
3429
3434
|
|
|
3430
|
-
For more information see https://redis.io/commands/srandmember
|
|
3435
|
+
For more information, see https://redis.io/commands/srandmember
|
|
3431
3436
|
"""
|
|
3432
3437
|
args = (number is not None) and [number] or []
|
|
3433
3438
|
return self.execute_command("SRANDMEMBER", name, *args)
|
|
@@ -3436,7 +3441,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3436
3441
|
"""
|
|
3437
3442
|
Remove ``values`` from set ``name``
|
|
3438
3443
|
|
|
3439
|
-
For more information see https://redis.io/commands/srem
|
|
3444
|
+
For more information, see https://redis.io/commands/srem
|
|
3440
3445
|
"""
|
|
3441
3446
|
return self.execute_command("SREM", name, *values)
|
|
3442
3447
|
|
|
@@ -3444,7 +3449,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3444
3449
|
"""
|
|
3445
3450
|
Return the union of sets specified by ``keys``
|
|
3446
3451
|
|
|
3447
|
-
For more information see https://redis.io/commands/sunion
|
|
3452
|
+
For more information, see https://redis.io/commands/sunion
|
|
3448
3453
|
"""
|
|
3449
3454
|
args = list_or_args(keys, args)
|
|
3450
3455
|
return self.execute_command("SUNION", *args, keys=args)
|
|
@@ -3456,7 +3461,7 @@ class SetCommands(CommandsProtocol):
|
|
|
3456
3461
|
Store the union of sets specified by ``keys`` into a new
|
|
3457
3462
|
set named ``dest``. Returns the number of keys in the new set.
|
|
3458
3463
|
|
|
3459
|
-
For more information see https://redis.io/commands/sunionstore
|
|
3464
|
+
For more information, see https://redis.io/commands/sunionstore
|
|
3460
3465
|
"""
|
|
3461
3466
|
args = list_or_args(keys, args)
|
|
3462
3467
|
return self.execute_command("SUNIONSTORE", dest, *args)
|
|
@@ -3480,7 +3485,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3480
3485
|
groupname: name of the consumer group.
|
|
3481
3486
|
*ids: message ids to acknowledge.
|
|
3482
3487
|
|
|
3483
|
-
For more information see https://redis.io/commands/xack
|
|
3488
|
+
For more information, see https://redis.io/commands/xack
|
|
3484
3489
|
"""
|
|
3485
3490
|
return self.execute_command("XACK", name, groupname, *ids)
|
|
3486
3491
|
|
|
@@ -3535,7 +3540,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3535
3540
|
- DELREF: When trimming, removes all references from consumer groups' PEL
|
|
3536
3541
|
- ACKED: When trimming, only removes entries acknowledged by all consumer groups
|
|
3537
3542
|
|
|
3538
|
-
For more information see https://redis.io/commands/xadd
|
|
3543
|
+
For more information, see https://redis.io/commands/xadd
|
|
3539
3544
|
"""
|
|
3540
3545
|
pieces: list[EncodableT] = []
|
|
3541
3546
|
if maxlen is not None and minid is not None:
|
|
@@ -3595,7 +3600,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3595
3600
|
justid: optional boolean, false by default. Return just an array of IDs
|
|
3596
3601
|
of messages successfully claimed, without returning the actual message
|
|
3597
3602
|
|
|
3598
|
-
For more information see https://redis.io/commands/xautoclaim
|
|
3603
|
+
For more information, see https://redis.io/commands/xautoclaim
|
|
3599
3604
|
"""
|
|
3600
3605
|
try:
|
|
3601
3606
|
if int(min_idle_time) < 0:
|
|
@@ -3665,7 +3670,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3665
3670
|
justid: optional boolean, false by default. Return just an array of IDs
|
|
3666
3671
|
of messages successfully claimed, without returning the actual message
|
|
3667
3672
|
|
|
3668
|
-
For more information see https://redis.io/commands/xclaim
|
|
3673
|
+
For more information, see https://redis.io/commands/xclaim
|
|
3669
3674
|
"""
|
|
3670
3675
|
if not isinstance(min_idle_time, int) or min_idle_time < 0:
|
|
3671
3676
|
raise DataError("XCLAIM min_idle_time must be a non negative integer")
|
|
@@ -3711,7 +3716,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3711
3716
|
name: name of the stream.
|
|
3712
3717
|
*ids: message ids to delete.
|
|
3713
3718
|
|
|
3714
|
-
For more information see https://redis.io/commands/xdel
|
|
3719
|
+
For more information, see https://redis.io/commands/xdel
|
|
3715
3720
|
"""
|
|
3716
3721
|
return self.execute_command("XDEL", name, *ids)
|
|
3717
3722
|
|
|
@@ -3749,7 +3754,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3749
3754
|
groupname: name of the consumer group.
|
|
3750
3755
|
id: ID of the last item in the stream to consider already delivered.
|
|
3751
3756
|
|
|
3752
|
-
For more information see https://redis.io/commands/xgroup-create
|
|
3757
|
+
For more information, see https://redis.io/commands/xgroup-create
|
|
3753
3758
|
"""
|
|
3754
3759
|
pieces: list[EncodableT] = ["XGROUP CREATE", name, groupname, id]
|
|
3755
3760
|
if mkstream:
|
|
@@ -3770,7 +3775,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3770
3775
|
groupname: name of the consumer group.
|
|
3771
3776
|
consumername: name of consumer to delete
|
|
3772
3777
|
|
|
3773
|
-
For more information see https://redis.io/commands/xgroup-delconsumer
|
|
3778
|
+
For more information, see https://redis.io/commands/xgroup-delconsumer
|
|
3774
3779
|
"""
|
|
3775
3780
|
return self.execute_command("XGROUP DELCONSUMER", name, groupname, consumername)
|
|
3776
3781
|
|
|
@@ -3780,7 +3785,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3780
3785
|
name: name of the stream.
|
|
3781
3786
|
groupname: name of the consumer group.
|
|
3782
3787
|
|
|
3783
|
-
For more information see https://redis.io/commands/xgroup-destroy
|
|
3788
|
+
For more information, see https://redis.io/commands/xgroup-destroy
|
|
3784
3789
|
"""
|
|
3785
3790
|
return self.execute_command("XGROUP DESTROY", name, groupname)
|
|
3786
3791
|
|
|
@@ -3814,7 +3819,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3814
3819
|
groupname: name of the consumer group.
|
|
3815
3820
|
id: ID of the last item in the stream to consider already delivered.
|
|
3816
3821
|
|
|
3817
|
-
For more information see https://redis.io/commands/xgroup-setid
|
|
3822
|
+
For more information, see https://redis.io/commands/xgroup-setid
|
|
3818
3823
|
"""
|
|
3819
3824
|
pieces = [name, groupname, id]
|
|
3820
3825
|
if entries_read is not None:
|
|
@@ -3827,7 +3832,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3827
3832
|
name: name of the stream.
|
|
3828
3833
|
groupname: name of the consumer group.
|
|
3829
3834
|
|
|
3830
|
-
For more information see https://redis.io/commands/xinfo-consumers
|
|
3835
|
+
For more information, see https://redis.io/commands/xinfo-consumers
|
|
3831
3836
|
"""
|
|
3832
3837
|
return self.execute_command("XINFO CONSUMERS", name, groupname)
|
|
3833
3838
|
|
|
@@ -3836,7 +3841,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3836
3841
|
Returns general information about the consumer groups of the stream.
|
|
3837
3842
|
name: name of the stream.
|
|
3838
3843
|
|
|
3839
|
-
For more information see https://redis.io/commands/xinfo-groups
|
|
3844
|
+
For more information, see https://redis.io/commands/xinfo-groups
|
|
3840
3845
|
"""
|
|
3841
3846
|
return self.execute_command("XINFO GROUPS", name)
|
|
3842
3847
|
|
|
@@ -3846,7 +3851,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3846
3851
|
name: name of the stream.
|
|
3847
3852
|
full: optional boolean, false by default. Return full summary
|
|
3848
3853
|
|
|
3849
|
-
For more information see https://redis.io/commands/xinfo-stream
|
|
3854
|
+
For more information, see https://redis.io/commands/xinfo-stream
|
|
3850
3855
|
"""
|
|
3851
3856
|
pieces = [name]
|
|
3852
3857
|
options = {}
|
|
@@ -3859,7 +3864,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3859
3864
|
"""
|
|
3860
3865
|
Returns the number of elements in a given stream.
|
|
3861
3866
|
|
|
3862
|
-
For more information see https://redis.io/commands/xlen
|
|
3867
|
+
For more information, see https://redis.io/commands/xlen
|
|
3863
3868
|
"""
|
|
3864
3869
|
return self.execute_command("XLEN", name, keys=[name])
|
|
3865
3870
|
|
|
@@ -3869,7 +3874,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3869
3874
|
name: name of the stream.
|
|
3870
3875
|
groupname: name of the consumer group.
|
|
3871
3876
|
|
|
3872
|
-
For more information see https://redis.io/commands/xpending
|
|
3877
|
+
For more information, see https://redis.io/commands/xpending
|
|
3873
3878
|
"""
|
|
3874
3879
|
return self.execute_command("XPENDING", name, groupname, keys=[name])
|
|
3875
3880
|
|
|
@@ -3951,7 +3956,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3951
3956
|
count: if set, only return this many items, beginning with the
|
|
3952
3957
|
earliest available.
|
|
3953
3958
|
|
|
3954
|
-
For more information see https://redis.io/commands/xrange
|
|
3959
|
+
For more information, see https://redis.io/commands/xrange
|
|
3955
3960
|
"""
|
|
3956
3961
|
pieces = [min, max]
|
|
3957
3962
|
if count is not None:
|
|
@@ -3979,7 +3984,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
3979
3984
|
|
|
3980
3985
|
block: number of milliseconds to wait, if nothing already present.
|
|
3981
3986
|
|
|
3982
|
-
For more information see https://redis.io/commands/xread
|
|
3987
|
+
For more information, see https://redis.io/commands/xread
|
|
3983
3988
|
"""
|
|
3984
3989
|
pieces = []
|
|
3985
3990
|
if block is not None:
|
|
@@ -4025,7 +4030,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
4025
4030
|
block: number of milliseconds to wait, if nothing already present.
|
|
4026
4031
|
noack: do not add messages to the PEL
|
|
4027
4032
|
|
|
4028
|
-
For more information see https://redis.io/commands/xreadgroup
|
|
4033
|
+
For more information, see https://redis.io/commands/xreadgroup
|
|
4029
4034
|
"""
|
|
4030
4035
|
pieces: list[EncodableT] = [b"GROUP", groupname, consumername]
|
|
4031
4036
|
if count is not None:
|
|
@@ -4068,7 +4073,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
4068
4073
|
count: if set, only return this many items, beginning with the
|
|
4069
4074
|
latest available.
|
|
4070
4075
|
|
|
4071
|
-
For more information see https://redis.io/commands/xrevrange
|
|
4076
|
+
For more information, see https://redis.io/commands/xrevrange
|
|
4072
4077
|
"""
|
|
4073
4078
|
pieces: list[EncodableT] = [max, min]
|
|
4074
4079
|
if count is not None:
|
|
@@ -4102,7 +4107,7 @@ class StreamCommands(CommandsProtocol):
|
|
|
4102
4107
|
- DELREF: Trims entries and removes all references from consumer groups' PEL
|
|
4103
4108
|
- ACKED: Only trims entries that were read and acknowledged by all consumer groups
|
|
4104
4109
|
|
|
4105
|
-
For more information see https://redis.io/commands/xtrim
|
|
4110
|
+
For more information, see https://redis.io/commands/xtrim
|
|
4106
4111
|
"""
|
|
4107
4112
|
pieces: list[EncodableT] = []
|
|
4108
4113
|
if maxlen is not None and minid is not None:
|
|
@@ -4172,17 +4177,17 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4172
4177
|
the existing score will be incremented by. When using this mode the
|
|
4173
4178
|
return value of ZADD will be the new score of the element.
|
|
4174
4179
|
|
|
4175
|
-
``
|
|
4180
|
+
``lt`` only updates existing elements if the new score is less than
|
|
4176
4181
|
the current score. This flag doesn't prevent adding new elements.
|
|
4177
4182
|
|
|
4178
|
-
``
|
|
4183
|
+
``gt`` only updates existing elements if the new score is greater than
|
|
4179
4184
|
the current score. This flag doesn't prevent adding new elements.
|
|
4180
4185
|
|
|
4181
4186
|
The return value of ZADD varies based on the mode specified. With no
|
|
4182
4187
|
options, ZADD returns the number of new elements added to the sorted
|
|
4183
4188
|
set.
|
|
4184
4189
|
|
|
4185
|
-
``
|
|
4190
|
+
``nx``, ``lt``, and ``gt`` are mutually exclusive options.
|
|
4186
4191
|
|
|
4187
4192
|
See: https://redis.io/commands/ZADD
|
|
4188
4193
|
"""
|
|
@@ -4223,7 +4228,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4223
4228
|
"""
|
|
4224
4229
|
Return the number of elements in the sorted set ``name``
|
|
4225
4230
|
|
|
4226
|
-
For more information see https://redis.io/commands/zcard
|
|
4231
|
+
For more information, see https://redis.io/commands/zcard
|
|
4227
4232
|
"""
|
|
4228
4233
|
return self.execute_command("ZCARD", name, keys=[name])
|
|
4229
4234
|
|
|
@@ -4232,7 +4237,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4232
4237
|
Returns the number of elements in the sorted set at key ``name`` with
|
|
4233
4238
|
a score between ``min`` and ``max``.
|
|
4234
4239
|
|
|
4235
|
-
For more information see https://redis.io/commands/zcount
|
|
4240
|
+
For more information, see https://redis.io/commands/zcount
|
|
4236
4241
|
"""
|
|
4237
4242
|
return self.execute_command("ZCOUNT", name, min, max, keys=[name])
|
|
4238
4243
|
|
|
@@ -4241,7 +4246,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4241
4246
|
Returns the difference between the first and all successive input
|
|
4242
4247
|
sorted sets provided in ``keys``.
|
|
4243
4248
|
|
|
4244
|
-
For more information see https://redis.io/commands/zdiff
|
|
4249
|
+
For more information, see https://redis.io/commands/zdiff
|
|
4245
4250
|
"""
|
|
4246
4251
|
pieces = [len(keys), *keys]
|
|
4247
4252
|
if withscores:
|
|
@@ -4253,7 +4258,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4253
4258
|
Computes the difference between the first and all successive input
|
|
4254
4259
|
sorted sets provided in ``keys`` and stores the result in ``dest``.
|
|
4255
4260
|
|
|
4256
|
-
For more information see https://redis.io/commands/zdiffstore
|
|
4261
|
+
For more information, see https://redis.io/commands/zdiffstore
|
|
4257
4262
|
"""
|
|
4258
4263
|
pieces = [len(keys), *keys]
|
|
4259
4264
|
return self.execute_command("ZDIFFSTORE", dest, *pieces)
|
|
@@ -4262,7 +4267,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4262
4267
|
"""
|
|
4263
4268
|
Increment the score of ``value`` in sorted set ``name`` by ``amount``
|
|
4264
4269
|
|
|
4265
|
-
For more information see https://redis.io/commands/zincrby
|
|
4270
|
+
For more information, see https://redis.io/commands/zincrby
|
|
4266
4271
|
"""
|
|
4267
4272
|
return self.execute_command("ZINCRBY", name, amount, value)
|
|
4268
4273
|
|
|
@@ -4278,7 +4283,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4278
4283
|
set will contain the minimum or maximum score of an element across
|
|
4279
4284
|
the inputs where it exists.
|
|
4280
4285
|
|
|
4281
|
-
For more information see https://redis.io/commands/zinter
|
|
4286
|
+
For more information, see https://redis.io/commands/zinter
|
|
4282
4287
|
"""
|
|
4283
4288
|
return self._zaggregate("ZINTER", None, keys, aggregate, withscores=withscores)
|
|
4284
4289
|
|
|
@@ -4297,7 +4302,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4297
4302
|
contain the minimum or maximum score of an element across the inputs
|
|
4298
4303
|
where it exists.
|
|
4299
4304
|
|
|
4300
|
-
For more information see https://redis.io/commands/zinterstore
|
|
4305
|
+
For more information, see https://redis.io/commands/zinterstore
|
|
4301
4306
|
"""
|
|
4302
4307
|
return self._zaggregate("ZINTERSTORE", dest, keys, aggregate)
|
|
4303
4308
|
|
|
@@ -4311,7 +4316,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4311
4316
|
cardinality reaches limit partway through the computation, the algorithm will
|
|
4312
4317
|
exit and yield limit as the cardinality
|
|
4313
4318
|
|
|
4314
|
-
For more information see https://redis.io/commands/zintercard
|
|
4319
|
+
For more information, see https://redis.io/commands/zintercard
|
|
4315
4320
|
"""
|
|
4316
4321
|
args = [numkeys, *keys, "LIMIT", limit]
|
|
4317
4322
|
return self.execute_command("ZINTERCARD", *args, keys=keys)
|
|
@@ -4321,7 +4326,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4321
4326
|
Return the number of items in the sorted set ``name`` between the
|
|
4322
4327
|
lexicographical range ``min`` and ``max``.
|
|
4323
4328
|
|
|
4324
|
-
For more information see https://redis.io/commands/zlexcount
|
|
4329
|
+
For more information, see https://redis.io/commands/zlexcount
|
|
4325
4330
|
"""
|
|
4326
4331
|
return self.execute_command("ZLEXCOUNT", name, min, max, keys=[name])
|
|
4327
4332
|
|
|
@@ -4330,7 +4335,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4330
4335
|
Remove and return up to ``count`` members with the highest scores
|
|
4331
4336
|
from the sorted set ``name``.
|
|
4332
4337
|
|
|
4333
|
-
For more information see https://redis.io/commands/zpopmax
|
|
4338
|
+
For more information, see https://redis.io/commands/zpopmax
|
|
4334
4339
|
"""
|
|
4335
4340
|
args = (count is not None) and [count] or []
|
|
4336
4341
|
options = {"withscores": True}
|
|
@@ -4341,7 +4346,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4341
4346
|
Remove and return up to ``count`` members with the lowest scores
|
|
4342
4347
|
from the sorted set ``name``.
|
|
4343
4348
|
|
|
4344
|
-
For more information see https://redis.io/commands/zpopmin
|
|
4349
|
+
For more information, see https://redis.io/commands/zpopmin
|
|
4345
4350
|
"""
|
|
4346
4351
|
args = (count is not None) and [count] or []
|
|
4347
4352
|
options = {"withscores": True}
|
|
@@ -4363,7 +4368,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4363
4368
|
includes the respective scores of the randomly selected elements from
|
|
4364
4369
|
the sorted set.
|
|
4365
4370
|
|
|
4366
|
-
For more information see https://redis.io/commands/zrandmember
|
|
4371
|
+
For more information, see https://redis.io/commands/zrandmember
|
|
4367
4372
|
"""
|
|
4368
4373
|
params = []
|
|
4369
4374
|
if count is not None:
|
|
@@ -4384,7 +4389,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4384
4389
|
|
|
4385
4390
|
If timeout is 0, then block indefinitely.
|
|
4386
4391
|
|
|
4387
|
-
For more information see https://redis.io/commands/bzpopmax
|
|
4392
|
+
For more information, see https://redis.io/commands/bzpopmax
|
|
4388
4393
|
"""
|
|
4389
4394
|
if timeout is None:
|
|
4390
4395
|
timeout = 0
|
|
@@ -4403,7 +4408,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4403
4408
|
|
|
4404
4409
|
If timeout is 0, then block indefinitely.
|
|
4405
4410
|
|
|
4406
|
-
For more information see https://redis.io/commands/bzpopmin
|
|
4411
|
+
For more information, see https://redis.io/commands/bzpopmin
|
|
4407
4412
|
"""
|
|
4408
4413
|
if timeout is None:
|
|
4409
4414
|
timeout = 0
|
|
@@ -4422,7 +4427,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4422
4427
|
"""
|
|
4423
4428
|
Pop ``count`` values (default 1) off of the first non-empty sorted set
|
|
4424
4429
|
named in the ``keys`` list.
|
|
4425
|
-
For more information see https://redis.io/commands/zmpop
|
|
4430
|
+
For more information, see https://redis.io/commands/zmpop
|
|
4426
4431
|
"""
|
|
4427
4432
|
args = [num_keys] + keys
|
|
4428
4433
|
if (min and max) or (not min and not max):
|
|
@@ -4455,7 +4460,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4455
4460
|
|
|
4456
4461
|
If timeout is 0, then block indefinitely.
|
|
4457
4462
|
|
|
4458
|
-
For more information see https://redis.io/commands/bzmpop
|
|
4463
|
+
For more information, see https://redis.io/commands/bzmpop
|
|
4459
4464
|
"""
|
|
4460
4465
|
args = [timeout, numkeys, *keys]
|
|
4461
4466
|
if (min and max) or (not min and not max):
|
|
@@ -4548,7 +4553,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4548
4553
|
``offset`` and ``num`` are specified, then return a slice of the range.
|
|
4549
4554
|
Can't be provided when using ``bylex``.
|
|
4550
4555
|
|
|
4551
|
-
For more information see https://redis.io/commands/zrange
|
|
4556
|
+
For more information, see https://redis.io/commands/zrange
|
|
4552
4557
|
"""
|
|
4553
4558
|
# Need to support ``desc`` also when using old redis version
|
|
4554
4559
|
# because it was supported in 3.5.3 (of redis-py)
|
|
@@ -4589,7 +4594,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4589
4594
|
|
|
4590
4595
|
``score_cast_func`` a callable used to cast the score return value
|
|
4591
4596
|
|
|
4592
|
-
For more information see https://redis.io/commands/zrevrange
|
|
4597
|
+
For more information, see https://redis.io/commands/zrevrange
|
|
4593
4598
|
"""
|
|
4594
4599
|
pieces = ["ZREVRANGE", name, start, end]
|
|
4595
4600
|
if withscores:
|
|
@@ -4631,7 +4636,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4631
4636
|
``offset`` and ``num`` are specified, then return a slice of the range.
|
|
4632
4637
|
Can't be provided when using ``bylex``.
|
|
4633
4638
|
|
|
4634
|
-
For more information see https://redis.io/commands/zrangestore
|
|
4639
|
+
For more information, see https://redis.io/commands/zrangestore
|
|
4635
4640
|
"""
|
|
4636
4641
|
return self._zrange(
|
|
4637
4642
|
"ZRANGESTORE",
|
|
@@ -4663,7 +4668,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4663
4668
|
If ``start`` and ``num`` are specified, then return a slice of the
|
|
4664
4669
|
range.
|
|
4665
4670
|
|
|
4666
|
-
For more information see https://redis.io/commands/zrangebylex
|
|
4671
|
+
For more information, see https://redis.io/commands/zrangebylex
|
|
4667
4672
|
"""
|
|
4668
4673
|
if (start is not None and num is None) or (num is not None and start is None):
|
|
4669
4674
|
raise DataError("``start`` and ``num`` must both be specified")
|
|
@@ -4687,7 +4692,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4687
4692
|
If ``start`` and ``num`` are specified, then return a slice of the
|
|
4688
4693
|
range.
|
|
4689
4694
|
|
|
4690
|
-
For more information see https://redis.io/commands/zrevrangebylex
|
|
4695
|
+
For more information, see https://redis.io/commands/zrevrangebylex
|
|
4691
4696
|
"""
|
|
4692
4697
|
if (start is not None and num is None) or (num is not None and start is None):
|
|
4693
4698
|
raise DataError("``start`` and ``num`` must both be specified")
|
|
@@ -4718,7 +4723,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4718
4723
|
|
|
4719
4724
|
`score_cast_func`` a callable used to cast the score return value
|
|
4720
4725
|
|
|
4721
|
-
For more information see https://redis.io/commands/zrangebyscore
|
|
4726
|
+
For more information, see https://redis.io/commands/zrangebyscore
|
|
4722
4727
|
"""
|
|
4723
4728
|
if (start is not None and num is None) or (num is not None and start is None):
|
|
4724
4729
|
raise DataError("``start`` and ``num`` must both be specified")
|
|
@@ -4753,7 +4758,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4753
4758
|
|
|
4754
4759
|
``score_cast_func`` a callable used to cast the score return value
|
|
4755
4760
|
|
|
4756
|
-
For more information see https://redis.io/commands/zrevrangebyscore
|
|
4761
|
+
For more information, see https://redis.io/commands/zrevrangebyscore
|
|
4757
4762
|
"""
|
|
4758
4763
|
if (start is not None and num is None) or (num is not None and start is None):
|
|
4759
4764
|
raise DataError("``start`` and ``num`` must both be specified")
|
|
@@ -4771,6 +4776,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4771
4776
|
name: KeyT,
|
|
4772
4777
|
value: EncodableT,
|
|
4773
4778
|
withscore: bool = False,
|
|
4779
|
+
score_cast_func: Union[type, Callable] = float,
|
|
4774
4780
|
) -> ResponseT:
|
|
4775
4781
|
"""
|
|
4776
4782
|
Returns a 0-based value indicating the rank of ``value`` in sorted set
|
|
@@ -4778,17 +4784,23 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4778
4784
|
The optional WITHSCORE argument supplements the command's
|
|
4779
4785
|
reply with the score of the element returned.
|
|
4780
4786
|
|
|
4781
|
-
|
|
4787
|
+
``score_cast_func`` a callable used to cast the score return value
|
|
4788
|
+
|
|
4789
|
+
For more information, see https://redis.io/commands/zrank
|
|
4782
4790
|
"""
|
|
4791
|
+
pieces = ["ZRANK", name, value]
|
|
4783
4792
|
if withscore:
|
|
4784
|
-
|
|
4785
|
-
|
|
4793
|
+
pieces.append("WITHSCORE")
|
|
4794
|
+
|
|
4795
|
+
options = {"withscore": withscore, "score_cast_func": score_cast_func}
|
|
4796
|
+
|
|
4797
|
+
return self.execute_command(*pieces, **options)
|
|
4786
4798
|
|
|
4787
4799
|
def zrem(self, name: KeyT, *values: FieldT) -> ResponseT:
|
|
4788
4800
|
"""
|
|
4789
4801
|
Remove member ``values`` from sorted set ``name``
|
|
4790
4802
|
|
|
4791
|
-
For more information see https://redis.io/commands/zrem
|
|
4803
|
+
For more information, see https://redis.io/commands/zrem
|
|
4792
4804
|
"""
|
|
4793
4805
|
return self.execute_command("ZREM", name, *values)
|
|
4794
4806
|
|
|
@@ -4799,7 +4811,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4799
4811
|
|
|
4800
4812
|
Returns the number of elements removed.
|
|
4801
4813
|
|
|
4802
|
-
For more information see https://redis.io/commands/zremrangebylex
|
|
4814
|
+
For more information, see https://redis.io/commands/zremrangebylex
|
|
4803
4815
|
"""
|
|
4804
4816
|
return self.execute_command("ZREMRANGEBYLEX", name, min, max)
|
|
4805
4817
|
|
|
@@ -4810,7 +4822,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4810
4822
|
to largest. Values can be negative indicating the highest scores.
|
|
4811
4823
|
Returns the number of elements removed
|
|
4812
4824
|
|
|
4813
|
-
For more information see https://redis.io/commands/zremrangebyrank
|
|
4825
|
+
For more information, see https://redis.io/commands/zremrangebyrank
|
|
4814
4826
|
"""
|
|
4815
4827
|
return self.execute_command("ZREMRANGEBYRANK", name, min, max)
|
|
4816
4828
|
|
|
@@ -4821,7 +4833,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4821
4833
|
Remove all elements in the sorted set ``name`` with scores
|
|
4822
4834
|
between ``min`` and ``max``. Returns the number of elements removed.
|
|
4823
4835
|
|
|
4824
|
-
For more information see https://redis.io/commands/zremrangebyscore
|
|
4836
|
+
For more information, see https://redis.io/commands/zremrangebyscore
|
|
4825
4837
|
"""
|
|
4826
4838
|
return self.execute_command("ZREMRANGEBYSCORE", name, min, max)
|
|
4827
4839
|
|
|
@@ -4830,6 +4842,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4830
4842
|
name: KeyT,
|
|
4831
4843
|
value: EncodableT,
|
|
4832
4844
|
withscore: bool = False,
|
|
4845
|
+
score_cast_func: Union[type, Callable] = float,
|
|
4833
4846
|
) -> ResponseT:
|
|
4834
4847
|
"""
|
|
4835
4848
|
Returns a 0-based value indicating the descending rank of
|
|
@@ -4837,19 +4850,23 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4837
4850
|
The optional ``withscore`` argument supplements the command's
|
|
4838
4851
|
reply with the score of the element returned.
|
|
4839
4852
|
|
|
4840
|
-
|
|
4853
|
+
``score_cast_func`` a callable used to cast the score return value
|
|
4854
|
+
|
|
4855
|
+
For more information, see https://redis.io/commands/zrevrank
|
|
4841
4856
|
"""
|
|
4857
|
+
pieces = ["ZREVRANK", name, value]
|
|
4842
4858
|
if withscore:
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4859
|
+
pieces.append("WITHSCORE")
|
|
4860
|
+
|
|
4861
|
+
options = {"withscore": withscore, "score_cast_func": score_cast_func}
|
|
4862
|
+
|
|
4863
|
+
return self.execute_command(*pieces, **options)
|
|
4847
4864
|
|
|
4848
4865
|
def zscore(self, name: KeyT, value: EncodableT) -> ResponseT:
|
|
4849
4866
|
"""
|
|
4850
4867
|
Return the score of element ``value`` in sorted set ``name``
|
|
4851
4868
|
|
|
4852
|
-
For more information see https://redis.io/commands/zscore
|
|
4869
|
+
For more information, see https://redis.io/commands/zscore
|
|
4853
4870
|
"""
|
|
4854
4871
|
return self.execute_command("ZSCORE", name, value, keys=[name])
|
|
4855
4872
|
|
|
@@ -4858,6 +4875,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4858
4875
|
keys: Union[Sequence[KeyT], Mapping[AnyKeyT, float]],
|
|
4859
4876
|
aggregate: Optional[str] = None,
|
|
4860
4877
|
withscores: bool = False,
|
|
4878
|
+
score_cast_func: Union[type, Callable] = float,
|
|
4861
4879
|
) -> ResponseT:
|
|
4862
4880
|
"""
|
|
4863
4881
|
Return the union of multiple sorted sets specified by ``keys``.
|
|
@@ -4865,9 +4883,18 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4865
4883
|
Scores will be aggregated based on the ``aggregate``, or SUM if
|
|
4866
4884
|
none is provided.
|
|
4867
4885
|
|
|
4868
|
-
|
|
4886
|
+
``score_cast_func`` a callable used to cast the score return value
|
|
4887
|
+
|
|
4888
|
+
For more information, see https://redis.io/commands/zunion
|
|
4869
4889
|
"""
|
|
4870
|
-
return self._zaggregate(
|
|
4890
|
+
return self._zaggregate(
|
|
4891
|
+
"ZUNION",
|
|
4892
|
+
None,
|
|
4893
|
+
keys,
|
|
4894
|
+
aggregate,
|
|
4895
|
+
withscores=withscores,
|
|
4896
|
+
score_cast_func=score_cast_func,
|
|
4897
|
+
)
|
|
4871
4898
|
|
|
4872
4899
|
def zunionstore(
|
|
4873
4900
|
self,
|
|
@@ -4880,7 +4907,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4880
4907
|
a new sorted set, ``dest``. Scores in the destination will be
|
|
4881
4908
|
aggregated based on the ``aggregate``, or SUM if none is provided.
|
|
4882
4909
|
|
|
4883
|
-
For more information see https://redis.io/commands/zunionstore
|
|
4910
|
+
For more information, see https://redis.io/commands/zunionstore
|
|
4884
4911
|
"""
|
|
4885
4912
|
return self._zaggregate("ZUNIONSTORE", dest, keys, aggregate)
|
|
4886
4913
|
|
|
@@ -4893,7 +4920,7 @@ class SortedSetCommands(CommandsProtocol):
|
|
|
4893
4920
|
If the member does not exist, a None will be returned
|
|
4894
4921
|
in corresponding position.
|
|
4895
4922
|
|
|
4896
|
-
For more information see https://redis.io/commands/zmscore
|
|
4923
|
+
For more information, see https://redis.io/commands/zmscore
|
|
4897
4924
|
"""
|
|
4898
4925
|
if not members:
|
|
4899
4926
|
raise DataError("ZMSCORE members must be a non-empty list")
|
|
@@ -4945,7 +4972,7 @@ class HyperlogCommands(CommandsProtocol):
|
|
|
4945
4972
|
"""
|
|
4946
4973
|
Adds the specified elements to the specified HyperLogLog.
|
|
4947
4974
|
|
|
4948
|
-
For more information see https://redis.io/commands/pfadd
|
|
4975
|
+
For more information, see https://redis.io/commands/pfadd
|
|
4949
4976
|
"""
|
|
4950
4977
|
return self.execute_command("PFADD", name, *values)
|
|
4951
4978
|
|
|
@@ -4954,7 +4981,7 @@ class HyperlogCommands(CommandsProtocol):
|
|
|
4954
4981
|
Return the approximated cardinality of
|
|
4955
4982
|
the set observed by the HyperLogLog at key(s).
|
|
4956
4983
|
|
|
4957
|
-
For more information see https://redis.io/commands/pfcount
|
|
4984
|
+
For more information, see https://redis.io/commands/pfcount
|
|
4958
4985
|
"""
|
|
4959
4986
|
return self.execute_command("PFCOUNT", *sources)
|
|
4960
4987
|
|
|
@@ -4962,7 +4989,7 @@ class HyperlogCommands(CommandsProtocol):
|
|
|
4962
4989
|
"""
|
|
4963
4990
|
Merge N different HyperLogLogs into a single one.
|
|
4964
4991
|
|
|
4965
|
-
For more information see https://redis.io/commands/pfmerge
|
|
4992
|
+
For more information, see https://redis.io/commands/pfmerge
|
|
4966
4993
|
"""
|
|
4967
4994
|
return self.execute_command("PFMERGE", dest, *sources)
|
|
4968
4995
|
|
|
@@ -4990,7 +5017,7 @@ class HashCommands(CommandsProtocol):
|
|
|
4990
5017
|
"""
|
|
4991
5018
|
Delete ``keys`` from hash ``name``
|
|
4992
5019
|
|
|
4993
|
-
For more information see https://redis.io/commands/hdel
|
|
5020
|
+
For more information, see https://redis.io/commands/hdel
|
|
4994
5021
|
"""
|
|
4995
5022
|
return self.execute_command("HDEL", name, *keys)
|
|
4996
5023
|
|
|
@@ -4998,7 +5025,7 @@ class HashCommands(CommandsProtocol):
|
|
|
4998
5025
|
"""
|
|
4999
5026
|
Returns a boolean indicating if ``key`` exists within hash ``name``
|
|
5000
5027
|
|
|
5001
|
-
For more information see https://redis.io/commands/hexists
|
|
5028
|
+
For more information, see https://redis.io/commands/hexists
|
|
5002
5029
|
"""
|
|
5003
5030
|
return self.execute_command("HEXISTS", name, key, keys=[name])
|
|
5004
5031
|
|
|
@@ -5008,7 +5035,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5008
5035
|
"""
|
|
5009
5036
|
Return the value of ``key`` within the hash ``name``
|
|
5010
5037
|
|
|
5011
|
-
For more information see https://redis.io/commands/hget
|
|
5038
|
+
For more information, see https://redis.io/commands/hget
|
|
5012
5039
|
"""
|
|
5013
5040
|
return self.execute_command("HGET", name, key, keys=[name])
|
|
5014
5041
|
|
|
@@ -5016,7 +5043,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5016
5043
|
"""
|
|
5017
5044
|
Return a Python dict of the hash's name/value pairs
|
|
5018
5045
|
|
|
5019
|
-
For more information see https://redis.io/commands/hgetall
|
|
5046
|
+
For more information, see https://redis.io/commands/hgetall
|
|
5020
5047
|
"""
|
|
5021
5048
|
return self.execute_command("HGETALL", name, keys=[name])
|
|
5022
5049
|
|
|
@@ -5032,7 +5059,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5032
5059
|
the key on success from the hash with the provided ```name```.
|
|
5033
5060
|
|
|
5034
5061
|
Available since Redis 8.0
|
|
5035
|
-
For more information see https://redis.io/commands/hgetdel
|
|
5062
|
+
For more information, see https://redis.io/commands/hgetdel
|
|
5036
5063
|
"""
|
|
5037
5064
|
if len(keys) == 0:
|
|
5038
5065
|
raise DataError("'hgetdel' should have at least one key provided")
|
|
@@ -5068,7 +5095,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5068
5095
|
``persist`` remove the time to live associated with the ``keys``.
|
|
5069
5096
|
|
|
5070
5097
|
Available since Redis 8.0
|
|
5071
|
-
For more information see https://redis.io/commands/hgetex
|
|
5098
|
+
For more information, see https://redis.io/commands/hgetex
|
|
5072
5099
|
"""
|
|
5073
5100
|
if not keys:
|
|
5074
5101
|
raise DataError("'hgetex' should have at least one key provided")
|
|
@@ -5100,7 +5127,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5100
5127
|
"""
|
|
5101
5128
|
Increment the value of ``key`` in hash ``name`` by ``amount``
|
|
5102
5129
|
|
|
5103
|
-
For more information see https://redis.io/commands/hincrby
|
|
5130
|
+
For more information, see https://redis.io/commands/hincrby
|
|
5104
5131
|
"""
|
|
5105
5132
|
return self.execute_command("HINCRBY", name, key, amount)
|
|
5106
5133
|
|
|
@@ -5110,7 +5137,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5110
5137
|
"""
|
|
5111
5138
|
Increment the value of ``key`` in hash ``name`` by floating ``amount``
|
|
5112
5139
|
|
|
5113
|
-
For more information see https://redis.io/commands/hincrbyfloat
|
|
5140
|
+
For more information, see https://redis.io/commands/hincrbyfloat
|
|
5114
5141
|
"""
|
|
5115
5142
|
return self.execute_command("HINCRBYFLOAT", name, key, amount)
|
|
5116
5143
|
|
|
@@ -5118,7 +5145,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5118
5145
|
"""
|
|
5119
5146
|
Return the list of keys within hash ``name``
|
|
5120
5147
|
|
|
5121
|
-
For more information see https://redis.io/commands/hkeys
|
|
5148
|
+
For more information, see https://redis.io/commands/hkeys
|
|
5122
5149
|
"""
|
|
5123
5150
|
return self.execute_command("HKEYS", name, keys=[name])
|
|
5124
5151
|
|
|
@@ -5126,7 +5153,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5126
5153
|
"""
|
|
5127
5154
|
Return the number of elements in hash ``name``
|
|
5128
5155
|
|
|
5129
|
-
For more information see https://redis.io/commands/hlen
|
|
5156
|
+
For more information, see https://redis.io/commands/hlen
|
|
5130
5157
|
"""
|
|
5131
5158
|
return self.execute_command("HLEN", name, keys=[name])
|
|
5132
5159
|
|
|
@@ -5146,7 +5173,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5146
5173
|
added to hash ``name``.
|
|
5147
5174
|
Returns the number of fields that were added.
|
|
5148
5175
|
|
|
5149
|
-
For more information see https://redis.io/commands/hset
|
|
5176
|
+
For more information, see https://redis.io/commands/hset
|
|
5150
5177
|
"""
|
|
5151
5178
|
|
|
5152
5179
|
if key is None and not mapping and not items:
|
|
@@ -5208,7 +5235,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5208
5235
|
Returns the number of fields that were added.
|
|
5209
5236
|
|
|
5210
5237
|
Available since Redis 8.0
|
|
5211
|
-
For more information see https://redis.io/commands/hsetex
|
|
5238
|
+
For more information, see https://redis.io/commands/hsetex
|
|
5212
5239
|
"""
|
|
5213
5240
|
if key is None and not mapping and not items:
|
|
5214
5241
|
raise DataError("'hsetex' with no key value pairs")
|
|
@@ -5251,7 +5278,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5251
5278
|
Set ``key`` to ``value`` within hash ``name`` if ``key`` does not
|
|
5252
5279
|
exist. Returns 1 if HSETNX created a field, otherwise 0.
|
|
5253
5280
|
|
|
5254
|
-
For more information see https://redis.io/commands/hsetnx
|
|
5281
|
+
For more information, see https://redis.io/commands/hsetnx
|
|
5255
5282
|
"""
|
|
5256
5283
|
return self.execute_command("HSETNX", name, key, value)
|
|
5257
5284
|
|
|
@@ -5265,7 +5292,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5265
5292
|
Set key to value within hash ``name`` for each corresponding
|
|
5266
5293
|
key and value from the ``mapping`` dict.
|
|
5267
5294
|
|
|
5268
|
-
For more information see https://redis.io/commands/hmset
|
|
5295
|
+
For more information, see https://redis.io/commands/hmset
|
|
5269
5296
|
"""
|
|
5270
5297
|
if not mapping:
|
|
5271
5298
|
raise DataError("'hmset' with 'mapping' of length 0")
|
|
@@ -5278,7 +5305,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5278
5305
|
"""
|
|
5279
5306
|
Returns a list of values ordered identically to ``keys``
|
|
5280
5307
|
|
|
5281
|
-
For more information see https://redis.io/commands/hmget
|
|
5308
|
+
For more information, see https://redis.io/commands/hmget
|
|
5282
5309
|
"""
|
|
5283
5310
|
args = list_or_args(keys, args)
|
|
5284
5311
|
return self.execute_command("HMGET", name, *args, keys=[name])
|
|
@@ -5287,7 +5314,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5287
5314
|
"""
|
|
5288
5315
|
Return the list of values within hash ``name``
|
|
5289
5316
|
|
|
5290
|
-
For more information see https://redis.io/commands/hvals
|
|
5317
|
+
For more information, see https://redis.io/commands/hvals
|
|
5291
5318
|
"""
|
|
5292
5319
|
return self.execute_command("HVALS", name, keys=[name])
|
|
5293
5320
|
|
|
@@ -5296,7 +5323,7 @@ class HashCommands(CommandsProtocol):
|
|
|
5296
5323
|
Return the number of bytes stored in the value of ``key``
|
|
5297
5324
|
within hash ``name``
|
|
5298
5325
|
|
|
5299
|
-
For more information see https://redis.io/commands/hstrlen
|
|
5326
|
+
For more information, see https://redis.io/commands/hstrlen
|
|
5300
5327
|
"""
|
|
5301
5328
|
return self.execute_command("HSTRLEN", name, key, keys=[name])
|
|
5302
5329
|
|
|
@@ -5790,7 +5817,7 @@ class PubSubCommands(CommandsProtocol):
|
|
|
5790
5817
|
Publish ``message`` on ``channel``.
|
|
5791
5818
|
Returns the number of subscribers the message was delivered to.
|
|
5792
5819
|
|
|
5793
|
-
For more information see https://redis.io/commands/publish
|
|
5820
|
+
For more information, see https://redis.io/commands/publish
|
|
5794
5821
|
"""
|
|
5795
5822
|
return self.execute_command("PUBLISH", channel, message, **kwargs)
|
|
5796
5823
|
|
|
@@ -5799,7 +5826,7 @@ class PubSubCommands(CommandsProtocol):
|
|
|
5799
5826
|
Posts a message to the given shard channel.
|
|
5800
5827
|
Returns the number of clients that received the message
|
|
5801
5828
|
|
|
5802
|
-
For more information see https://redis.io/commands/spublish
|
|
5829
|
+
For more information, see https://redis.io/commands/spublish
|
|
5803
5830
|
"""
|
|
5804
5831
|
return self.execute_command("SPUBLISH", shard_channel, message)
|
|
5805
5832
|
|
|
@@ -5807,7 +5834,7 @@ class PubSubCommands(CommandsProtocol):
|
|
|
5807
5834
|
"""
|
|
5808
5835
|
Return a list of channels that have at least one subscriber
|
|
5809
5836
|
|
|
5810
|
-
For more information see https://redis.io/commands/pubsub-channels
|
|
5837
|
+
For more information, see https://redis.io/commands/pubsub-channels
|
|
5811
5838
|
"""
|
|
5812
5839
|
return self.execute_command("PUBSUB CHANNELS", pattern, **kwargs)
|
|
5813
5840
|
|
|
@@ -5815,7 +5842,7 @@ class PubSubCommands(CommandsProtocol):
|
|
|
5815
5842
|
"""
|
|
5816
5843
|
Return a list of shard_channels that have at least one subscriber
|
|
5817
5844
|
|
|
5818
|
-
For more information see https://redis.io/commands/pubsub-shardchannels
|
|
5845
|
+
For more information, see https://redis.io/commands/pubsub-shardchannels
|
|
5819
5846
|
"""
|
|
5820
5847
|
return self.execute_command("PUBSUB SHARDCHANNELS", pattern, **kwargs)
|
|
5821
5848
|
|
|
@@ -5823,7 +5850,7 @@ class PubSubCommands(CommandsProtocol):
|
|
|
5823
5850
|
"""
|
|
5824
5851
|
Returns the number of subscriptions to patterns
|
|
5825
5852
|
|
|
5826
|
-
For more information see https://redis.io/commands/pubsub-numpat
|
|
5853
|
+
For more information, see https://redis.io/commands/pubsub-numpat
|
|
5827
5854
|
"""
|
|
5828
5855
|
return self.execute_command("PUBSUB NUMPAT", **kwargs)
|
|
5829
5856
|
|
|
@@ -5832,7 +5859,7 @@ class PubSubCommands(CommandsProtocol):
|
|
|
5832
5859
|
Return a list of (channel, number of subscribers) tuples
|
|
5833
5860
|
for each channel given in ``*args``
|
|
5834
5861
|
|
|
5835
|
-
For more information see https://redis.io/commands/pubsub-numsub
|
|
5862
|
+
For more information, see https://redis.io/commands/pubsub-numsub
|
|
5836
5863
|
"""
|
|
5837
5864
|
return self.execute_command("PUBSUB NUMSUB", *args, **kwargs)
|
|
5838
5865
|
|
|
@@ -5841,7 +5868,7 @@ class PubSubCommands(CommandsProtocol):
|
|
|
5841
5868
|
Return a list of (shard_channel, number of subscribers) tuples
|
|
5842
5869
|
for each channel given in ``*args``
|
|
5843
5870
|
|
|
5844
|
-
For more information see https://redis.io/commands/pubsub-shardnumsub
|
|
5871
|
+
For more information, see https://redis.io/commands/pubsub-shardnumsub
|
|
5845
5872
|
"""
|
|
5846
5873
|
return self.execute_command("PUBSUB SHARDNUMSUB", *args, **kwargs)
|
|
5847
5874
|
|
|
@@ -5856,12 +5883,16 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5856
5883
|
"""
|
|
5857
5884
|
|
|
5858
5885
|
def _eval(
|
|
5859
|
-
self,
|
|
5886
|
+
self,
|
|
5887
|
+
command: str,
|
|
5888
|
+
script: str,
|
|
5889
|
+
numkeys: int,
|
|
5890
|
+
*keys_and_args: Union[KeyT, EncodableT],
|
|
5860
5891
|
) -> Union[Awaitable[str], str]:
|
|
5861
5892
|
return self.execute_command(command, script, numkeys, *keys_and_args)
|
|
5862
5893
|
|
|
5863
5894
|
def eval(
|
|
5864
|
-
self, script: str, numkeys: int, *keys_and_args:
|
|
5895
|
+
self, script: str, numkeys: int, *keys_and_args: Union[KeyT, EncodableT]
|
|
5865
5896
|
) -> Union[Awaitable[str], str]:
|
|
5866
5897
|
"""
|
|
5867
5898
|
Execute the Lua ``script``, specifying the ``numkeys`` the script
|
|
@@ -5871,12 +5902,12 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5871
5902
|
In practice, use the object returned by ``register_script``. This
|
|
5872
5903
|
function exists purely for Redis API completion.
|
|
5873
5904
|
|
|
5874
|
-
For more information see https://redis.io/commands/eval
|
|
5905
|
+
For more information, see https://redis.io/commands/eval
|
|
5875
5906
|
"""
|
|
5876
5907
|
return self._eval("EVAL", script, numkeys, *keys_and_args)
|
|
5877
5908
|
|
|
5878
5909
|
def eval_ro(
|
|
5879
|
-
self, script: str, numkeys: int, *keys_and_args:
|
|
5910
|
+
self, script: str, numkeys: int, *keys_and_args: Union[KeyT, EncodableT]
|
|
5880
5911
|
) -> Union[Awaitable[str], str]:
|
|
5881
5912
|
"""
|
|
5882
5913
|
The read-only variant of the EVAL command
|
|
@@ -5885,17 +5916,21 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5885
5916
|
will touch and the key names and argument values in ``keys_and_args``.
|
|
5886
5917
|
Returns the result of the script.
|
|
5887
5918
|
|
|
5888
|
-
For more information see https://redis.io/commands/eval_ro
|
|
5919
|
+
For more information, see https://redis.io/commands/eval_ro
|
|
5889
5920
|
"""
|
|
5890
5921
|
return self._eval("EVAL_RO", script, numkeys, *keys_and_args)
|
|
5891
5922
|
|
|
5892
5923
|
def _evalsha(
|
|
5893
|
-
self,
|
|
5924
|
+
self,
|
|
5925
|
+
command: str,
|
|
5926
|
+
sha: str,
|
|
5927
|
+
numkeys: int,
|
|
5928
|
+
*keys_and_args: Union[KeyT, EncodableT],
|
|
5894
5929
|
) -> Union[Awaitable[str], str]:
|
|
5895
5930
|
return self.execute_command(command, sha, numkeys, *keys_and_args)
|
|
5896
5931
|
|
|
5897
5932
|
def evalsha(
|
|
5898
|
-
self, sha: str, numkeys: int, *keys_and_args:
|
|
5933
|
+
self, sha: str, numkeys: int, *keys_and_args: Union[KeyT, EncodableT]
|
|
5899
5934
|
) -> Union[Awaitable[str], str]:
|
|
5900
5935
|
"""
|
|
5901
5936
|
Use the ``sha`` to execute a Lua script already registered via EVAL
|
|
@@ -5906,12 +5941,12 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5906
5941
|
In practice, use the object returned by ``register_script``. This
|
|
5907
5942
|
function exists purely for Redis API completion.
|
|
5908
5943
|
|
|
5909
|
-
For more information see https://redis.io/commands/evalsha
|
|
5944
|
+
For more information, see https://redis.io/commands/evalsha
|
|
5910
5945
|
"""
|
|
5911
5946
|
return self._evalsha("EVALSHA", sha, numkeys, *keys_and_args)
|
|
5912
5947
|
|
|
5913
5948
|
def evalsha_ro(
|
|
5914
|
-
self, sha: str, numkeys: int, *keys_and_args:
|
|
5949
|
+
self, sha: str, numkeys: int, *keys_and_args: Union[KeyT, EncodableT]
|
|
5915
5950
|
) -> Union[Awaitable[str], str]:
|
|
5916
5951
|
"""
|
|
5917
5952
|
The read-only variant of the EVALSHA command
|
|
@@ -5921,7 +5956,7 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5921
5956
|
key names and argument values in ``keys_and_args``. Returns the result
|
|
5922
5957
|
of the script.
|
|
5923
5958
|
|
|
5924
|
-
For more information see https://redis.io/commands/evalsha_ro
|
|
5959
|
+
For more information, see https://redis.io/commands/evalsha_ro
|
|
5925
5960
|
"""
|
|
5926
5961
|
return self._evalsha("EVALSHA_RO", sha, numkeys, *keys_and_args)
|
|
5927
5962
|
|
|
@@ -5931,7 +5966,7 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5931
5966
|
each script as ``args``. Returns a list of boolean values indicating if
|
|
5932
5967
|
if each already script exists in the cache_data.
|
|
5933
5968
|
|
|
5934
|
-
For more information see https://redis.io/commands/script-exists
|
|
5969
|
+
For more information, see https://redis.io/commands/script-exists
|
|
5935
5970
|
"""
|
|
5936
5971
|
return self.execute_command("SCRIPT EXISTS", *args)
|
|
5937
5972
|
|
|
@@ -5948,7 +5983,7 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5948
5983
|
``sync_type`` is by default SYNC (synchronous) but it can also be
|
|
5949
5984
|
ASYNC.
|
|
5950
5985
|
|
|
5951
|
-
For more information see https://redis.io/commands/script-flush
|
|
5986
|
+
For more information, see https://redis.io/commands/script-flush
|
|
5952
5987
|
"""
|
|
5953
5988
|
|
|
5954
5989
|
# Redis pre 6 had no sync_type.
|
|
@@ -5968,7 +6003,7 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5968
6003
|
"""
|
|
5969
6004
|
Kill the currently executing Lua script
|
|
5970
6005
|
|
|
5971
|
-
For more information see https://redis.io/commands/script-kill
|
|
6006
|
+
For more information, see https://redis.io/commands/script-kill
|
|
5972
6007
|
"""
|
|
5973
6008
|
return self.execute_command("SCRIPT KILL")
|
|
5974
6009
|
|
|
@@ -5976,7 +6011,7 @@ class ScriptCommands(CommandsProtocol):
|
|
|
5976
6011
|
"""
|
|
5977
6012
|
Load a Lua ``script`` into the script cache_data. Returns the SHA.
|
|
5978
6013
|
|
|
5979
|
-
For more information see https://redis.io/commands/script-load
|
|
6014
|
+
For more information, see https://redis.io/commands/script-load
|
|
5980
6015
|
"""
|
|
5981
6016
|
return self.execute_command("SCRIPT LOAD", script)
|
|
5982
6017
|
|
|
@@ -6039,7 +6074,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6039
6074
|
Changed elements include new elements that were added and elements
|
|
6040
6075
|
whose scores changed.
|
|
6041
6076
|
|
|
6042
|
-
For more information see https://redis.io/commands/geoadd
|
|
6077
|
+
For more information, see https://redis.io/commands/geoadd
|
|
6043
6078
|
"""
|
|
6044
6079
|
if nx and xx:
|
|
6045
6080
|
raise DataError("GEOADD allows either 'nx' or 'xx', not both")
|
|
@@ -6064,7 +6099,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6064
6099
|
The units must be one of the following : m, km mi, ft. By default
|
|
6065
6100
|
meters are used.
|
|
6066
6101
|
|
|
6067
|
-
For more information see https://redis.io/commands/geodist
|
|
6102
|
+
For more information, see https://redis.io/commands/geodist
|
|
6068
6103
|
"""
|
|
6069
6104
|
pieces: list[EncodableT] = [name, place1, place2]
|
|
6070
6105
|
if unit and unit not in ("m", "km", "mi", "ft"):
|
|
@@ -6078,7 +6113,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6078
6113
|
Return the geo hash string for each item of ``values`` members of
|
|
6079
6114
|
the specified key identified by the ``name`` argument.
|
|
6080
6115
|
|
|
6081
|
-
For more information see https://redis.io/commands/geohash
|
|
6116
|
+
For more information, see https://redis.io/commands/geohash
|
|
6082
6117
|
"""
|
|
6083
6118
|
return self.execute_command("GEOHASH", name, *values, keys=[name])
|
|
6084
6119
|
|
|
@@ -6088,7 +6123,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6088
6123
|
the specified key identified by the ``name`` argument. Each position
|
|
6089
6124
|
is represented by the pairs lon and lat.
|
|
6090
6125
|
|
|
6091
|
-
For more information see https://redis.io/commands/geopos
|
|
6126
|
+
For more information, see https://redis.io/commands/geopos
|
|
6092
6127
|
"""
|
|
6093
6128
|
return self.execute_command("GEOPOS", name, *values, keys=[name])
|
|
6094
6129
|
|
|
@@ -6136,7 +6171,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6136
6171
|
named with a specific key, instead of ``store`` the sorted set
|
|
6137
6172
|
destination score is set with the distance.
|
|
6138
6173
|
|
|
6139
|
-
For more information see https://redis.io/commands/georadius
|
|
6174
|
+
For more information, see https://redis.io/commands/georadius
|
|
6140
6175
|
"""
|
|
6141
6176
|
return self._georadiusgeneric(
|
|
6142
6177
|
"GEORADIUS",
|
|
@@ -6176,7 +6211,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6176
6211
|
and latitude value, it takes the name of a member already existing
|
|
6177
6212
|
inside the geospatial index represented by the sorted set.
|
|
6178
6213
|
|
|
6179
|
-
For more information see https://redis.io/commands/georadiusbymember
|
|
6214
|
+
For more information, see https://redis.io/commands/georadiusbymember
|
|
6180
6215
|
"""
|
|
6181
6216
|
return self._georadiusgeneric(
|
|
6182
6217
|
"GEORADIUSBYMEMBER",
|
|
@@ -6298,7 +6333,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6298
6333
|
|
|
6299
6334
|
``withhash`` indicates to return the geohash string of each place.
|
|
6300
6335
|
|
|
6301
|
-
For more information see https://redis.io/commands/geosearch
|
|
6336
|
+
For more information, see https://redis.io/commands/geosearch
|
|
6302
6337
|
"""
|
|
6303
6338
|
|
|
6304
6339
|
return self._geosearchgeneric(
|
|
@@ -6345,7 +6380,7 @@ class GeoCommands(CommandsProtocol):
|
|
|
6345
6380
|
items in a sorted set populated with their distance from the
|
|
6346
6381
|
center of the circle or box, as a floating-point number.
|
|
6347
6382
|
|
|
6348
|
-
For more information see https://redis.io/commands/geosearchstore
|
|
6383
|
+
For more information, see https://redis.io/commands/geosearchstore
|
|
6349
6384
|
"""
|
|
6350
6385
|
return self._geosearchgeneric(
|
|
6351
6386
|
"GEOSEARCHSTORE",
|
|
@@ -6450,7 +6485,7 @@ class ModuleCommands(CommandsProtocol):
|
|
|
6450
6485
|
Passes all ``*args`` to the module, during loading.
|
|
6451
6486
|
Raises ``ModuleError`` if a module is not found at ``path``.
|
|
6452
6487
|
|
|
6453
|
-
For more information see https://redis.io/commands/module-load
|
|
6488
|
+
For more information, see https://redis.io/commands/module-load
|
|
6454
6489
|
"""
|
|
6455
6490
|
return self.execute_command("MODULE LOAD", path, *args)
|
|
6456
6491
|
|
|
@@ -6463,7 +6498,7 @@ class ModuleCommands(CommandsProtocol):
|
|
|
6463
6498
|
"""
|
|
6464
6499
|
Loads a module from a dynamic library at runtime with configuration directives.
|
|
6465
6500
|
|
|
6466
|
-
For more information see https://redis.io/commands/module-loadex
|
|
6501
|
+
For more information, see https://redis.io/commands/module-loadex
|
|
6467
6502
|
"""
|
|
6468
6503
|
pieces = []
|
|
6469
6504
|
if options is not None:
|
|
@@ -6480,7 +6515,7 @@ class ModuleCommands(CommandsProtocol):
|
|
|
6480
6515
|
Unloads the module ``name``.
|
|
6481
6516
|
Raises ``ModuleError`` if ``name`` is not in loaded modules.
|
|
6482
6517
|
|
|
6483
|
-
For more information see https://redis.io/commands/module-unload
|
|
6518
|
+
For more information, see https://redis.io/commands/module-unload
|
|
6484
6519
|
"""
|
|
6485
6520
|
return self.execute_command("MODULE UNLOAD", name)
|
|
6486
6521
|
|
|
@@ -6489,7 +6524,7 @@ class ModuleCommands(CommandsProtocol):
|
|
|
6489
6524
|
Returns a list of dictionaries containing the name and version of
|
|
6490
6525
|
all loaded modules.
|
|
6491
6526
|
|
|
6492
|
-
For more information see https://redis.io/commands/module-list
|
|
6527
|
+
For more information, see https://redis.io/commands/module-list
|
|
6493
6528
|
"""
|
|
6494
6529
|
return self.execute_command("MODULE LIST")
|
|
6495
6530
|
|
|
@@ -6525,7 +6560,7 @@ class ClusterCommands(CommandsProtocol):
|
|
|
6525
6560
|
"""
|
|
6526
6561
|
Disables read queries for a connection to a Redis Cluster slave node.
|
|
6527
6562
|
|
|
6528
|
-
For more information see https://redis.io/commands/readwrite
|
|
6563
|
+
For more information, see https://redis.io/commands/readwrite
|
|
6529
6564
|
"""
|
|
6530
6565
|
return self.execute_command("READWRITE", **kwargs)
|
|
6531
6566
|
|
|
@@ -6533,7 +6568,7 @@ class ClusterCommands(CommandsProtocol):
|
|
|
6533
6568
|
"""
|
|
6534
6569
|
Enables read queries for a connection to a Redis Cluster replica node.
|
|
6535
6570
|
|
|
6536
|
-
For more information see https://redis.io/commands/readonly
|
|
6571
|
+
For more information, see https://redis.io/commands/readonly
|
|
6537
6572
|
"""
|
|
6538
6573
|
return self.execute_command("READONLY", **kwargs)
|
|
6539
6574
|
|
|
@@ -6557,7 +6592,7 @@ class FunctionCommands:
|
|
|
6557
6592
|
with the new contents.
|
|
6558
6593
|
Return the library name that was loaded.
|
|
6559
6594
|
|
|
6560
|
-
For more information see https://redis.io/commands/function-load
|
|
6595
|
+
For more information, see https://redis.io/commands/function-load
|
|
6561
6596
|
"""
|
|
6562
6597
|
pieces = ["REPLACE"] if replace else []
|
|
6563
6598
|
pieces.append(code)
|
|
@@ -6567,7 +6602,7 @@ class FunctionCommands:
|
|
|
6567
6602
|
"""
|
|
6568
6603
|
Delete the library called ``library`` and all its functions.
|
|
6569
6604
|
|
|
6570
|
-
For more information see https://redis.io/commands/function-delete
|
|
6605
|
+
For more information, see https://redis.io/commands/function-delete
|
|
6571
6606
|
"""
|
|
6572
6607
|
return self.execute_command("FUNCTION DELETE", library)
|
|
6573
6608
|
|
|
@@ -6575,7 +6610,7 @@ class FunctionCommands:
|
|
|
6575
6610
|
"""
|
|
6576
6611
|
Deletes all the libraries.
|
|
6577
6612
|
|
|
6578
|
-
For more information see https://redis.io/commands/function-flush
|
|
6613
|
+
For more information, see https://redis.io/commands/function-flush
|
|
6579
6614
|
"""
|
|
6580
6615
|
return self.execute_command("FUNCTION FLUSH", mode)
|
|
6581
6616
|
|
|
@@ -6607,7 +6642,7 @@ class FunctionCommands:
|
|
|
6607
6642
|
"""
|
|
6608
6643
|
Invoke a function.
|
|
6609
6644
|
|
|
6610
|
-
For more information see https://redis.io/commands/fcall
|
|
6645
|
+
For more information, see https://redis.io/commands/fcall
|
|
6611
6646
|
"""
|
|
6612
6647
|
return self._fcall("FCALL", function, numkeys, *keys_and_args)
|
|
6613
6648
|
|
|
@@ -6618,7 +6653,7 @@ class FunctionCommands:
|
|
|
6618
6653
|
This is a read-only variant of the FCALL command that cannot
|
|
6619
6654
|
execute commands that modify data.
|
|
6620
6655
|
|
|
6621
|
-
For more information see https://redis.io/commands/fcall_ro
|
|
6656
|
+
For more information, see https://redis.io/commands/fcall_ro
|
|
6622
6657
|
"""
|
|
6623
6658
|
return self._fcall("FCALL_RO", function, numkeys, *keys_and_args)
|
|
6624
6659
|
|
|
@@ -6626,7 +6661,7 @@ class FunctionCommands:
|
|
|
6626
6661
|
"""
|
|
6627
6662
|
Return the serialized payload of loaded libraries.
|
|
6628
6663
|
|
|
6629
|
-
For more information see https://redis.io/commands/function-dump
|
|
6664
|
+
For more information, see https://redis.io/commands/function-dump
|
|
6630
6665
|
"""
|
|
6631
6666
|
from redis.client import NEVER_DECODE
|
|
6632
6667
|
|
|
@@ -6643,7 +6678,7 @@ class FunctionCommands:
|
|
|
6643
6678
|
You can use the optional policy argument to provide a policy
|
|
6644
6679
|
for handling existing libraries.
|
|
6645
6680
|
|
|
6646
|
-
For more information see https://redis.io/commands/function-restore
|
|
6681
|
+
For more information, see https://redis.io/commands/function-restore
|
|
6647
6682
|
"""
|
|
6648
6683
|
return self.execute_command("FUNCTION RESTORE", payload, policy)
|
|
6649
6684
|
|
|
@@ -6651,7 +6686,7 @@ class FunctionCommands:
|
|
|
6651
6686
|
"""
|
|
6652
6687
|
Kill a function that is currently executing.
|
|
6653
6688
|
|
|
6654
|
-
For more information see https://redis.io/commands/function-kill
|
|
6689
|
+
For more information, see https://redis.io/commands/function-kill
|
|
6655
6690
|
"""
|
|
6656
6691
|
return self.execute_command("FUNCTION KILL")
|
|
6657
6692
|
|
|
@@ -6660,7 +6695,7 @@ class FunctionCommands:
|
|
|
6660
6695
|
Return information about the function that's currently running
|
|
6661
6696
|
and information about the available execution engines.
|
|
6662
6697
|
|
|
6663
|
-
For more information see https://redis.io/commands/function-stats
|
|
6698
|
+
For more information, see https://redis.io/commands/function-stats
|
|
6664
6699
|
"""
|
|
6665
6700
|
return self.execute_command("FUNCTION STATS")
|
|
6666
6701
|
|