valkey-glide 1.3.5rc2__pp39-pypy39_pp73-macosx_10_7_x86_64.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.
Potentially problematic release.
This version of valkey-glide might be problematic. Click here for more details.
- glide/__init__.py +330 -0
- glide/async_commands/__init__.py +5 -0
- glide/async_commands/bitmap.py +311 -0
- glide/async_commands/cluster_commands.py +1294 -0
- glide/async_commands/command_args.py +102 -0
- glide/async_commands/core.py +7040 -0
- glide/async_commands/server_modules/ft.py +395 -0
- glide/async_commands/server_modules/ft_options/ft_aggregate_options.py +293 -0
- glide/async_commands/server_modules/ft_options/ft_constants.py +84 -0
- glide/async_commands/server_modules/ft_options/ft_create_options.py +409 -0
- glide/async_commands/server_modules/ft_options/ft_profile_options.py +108 -0
- glide/async_commands/server_modules/ft_options/ft_search_options.py +131 -0
- glide/async_commands/server_modules/glide_json.py +1255 -0
- glide/async_commands/server_modules/json_batch.py +790 -0
- glide/async_commands/sorted_set.py +402 -0
- glide/async_commands/standalone_commands.py +935 -0
- glide/async_commands/stream.py +442 -0
- glide/async_commands/transaction.py +5175 -0
- glide/config.py +590 -0
- glide/constants.py +120 -0
- glide/exceptions.py +62 -0
- glide/glide.pyi +36 -0
- glide/glide.pypy39-pp73-darwin.so +0 -0
- glide/glide_client.py +604 -0
- glide/logger.py +85 -0
- glide/protobuf/command_request_pb2.py +54 -0
- glide/protobuf/command_request_pb2.pyi +1164 -0
- glide/protobuf/connection_request_pb2.py +52 -0
- glide/protobuf/connection_request_pb2.pyi +292 -0
- glide/protobuf/response_pb2.py +32 -0
- glide/protobuf/response_pb2.pyi +101 -0
- glide/protobuf_codec.py +109 -0
- glide/py.typed +0 -0
- glide/routes.py +114 -0
- valkey_glide-1.3.5rc2.dist-info/METADATA +125 -0
- valkey_glide-1.3.5rc2.dist-info/RECORD +37 -0
- valkey_glide-1.3.5rc2.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,1294 @@
|
|
|
1
|
+
# Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, List, Mapping, Optional, Set, Union, cast
|
|
6
|
+
|
|
7
|
+
from glide.async_commands.command_args import Limit, ObjectType, OrderBy
|
|
8
|
+
from glide.async_commands.core import (
|
|
9
|
+
CoreCommands,
|
|
10
|
+
FlushMode,
|
|
11
|
+
FunctionRestorePolicy,
|
|
12
|
+
InfoSection,
|
|
13
|
+
_build_sort_args,
|
|
14
|
+
)
|
|
15
|
+
from glide.async_commands.transaction import ClusterTransaction
|
|
16
|
+
from glide.constants import (
|
|
17
|
+
TOK,
|
|
18
|
+
TClusterResponse,
|
|
19
|
+
TEncodable,
|
|
20
|
+
TFunctionListResponse,
|
|
21
|
+
TFunctionStatsSingleNodeResponse,
|
|
22
|
+
TResult,
|
|
23
|
+
TSingleNodeRoute,
|
|
24
|
+
)
|
|
25
|
+
from glide.protobuf.command_request_pb2 import RequestType
|
|
26
|
+
from glide.routes import Route
|
|
27
|
+
|
|
28
|
+
from ..glide import ClusterScanCursor, Script
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ClusterCommands(CoreCommands):
|
|
32
|
+
async def custom_command(
|
|
33
|
+
self, command_args: List[TEncodable], route: Optional[Route] = None
|
|
34
|
+
) -> TClusterResponse[TResult]:
|
|
35
|
+
"""
|
|
36
|
+
Executes a single command, without checking inputs.
|
|
37
|
+
See the [Valkey GLIDE Wiki](https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#custom-command)
|
|
38
|
+
for details on the restrictions and limitations of the custom command API.
|
|
39
|
+
|
|
40
|
+
@example - Return a list of all pub/sub clients from all nodes:
|
|
41
|
+
|
|
42
|
+
connection.customCommand(["CLIENT", "LIST","TYPE", "PUBSUB"], AllNodes())
|
|
43
|
+
Args:
|
|
44
|
+
command_args (List[TEncodable]): List of the command's arguments, where each argument is either a string or bytes.
|
|
45
|
+
Every part of the command, including the command name and subcommands, should be added as a separate value in args.
|
|
46
|
+
route (Optional[Route]): The command will be routed automatically based on the passed command's default request policy, unless `route` is provided, in which
|
|
47
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
TClusterResponse[TResult]: The returning value depends on the executed command and the route.
|
|
51
|
+
"""
|
|
52
|
+
return cast(
|
|
53
|
+
TClusterResponse[TResult],
|
|
54
|
+
await self._execute_command(RequestType.CustomCommand, command_args, route),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
async def info(
|
|
58
|
+
self,
|
|
59
|
+
sections: Optional[List[InfoSection]] = None,
|
|
60
|
+
route: Optional[Route] = None,
|
|
61
|
+
) -> TClusterResponse[bytes]:
|
|
62
|
+
"""
|
|
63
|
+
Get information and statistics about the server.
|
|
64
|
+
See https://valkey.io/commands/info/ for details.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
sections (Optional[List[InfoSection]]): A list of InfoSection values specifying which sections of
|
|
68
|
+
information to retrieve. When no parameter is provided, the default option is assumed.
|
|
69
|
+
route (Optional[Route]): The command will be routed to all primaries, unless `route` is provided, in which
|
|
70
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
TClusterResponse[bytes]: If a single node route is requested, returns a bytes string containing the information for
|
|
74
|
+
the required sections. Otherwise, returns a dict of bytes strings, with each key containing the address of
|
|
75
|
+
the queried node and value containing the information regarding the requested sections.
|
|
76
|
+
"""
|
|
77
|
+
args: List[TEncodable] = (
|
|
78
|
+
[section.value for section in sections] if sections else []
|
|
79
|
+
)
|
|
80
|
+
return cast(
|
|
81
|
+
TClusterResponse[bytes],
|
|
82
|
+
await self._execute_command(RequestType.Info, args, route),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
async def exec(
|
|
86
|
+
self,
|
|
87
|
+
transaction: ClusterTransaction,
|
|
88
|
+
route: Optional[TSingleNodeRoute] = None,
|
|
89
|
+
) -> Optional[List[TResult]]:
|
|
90
|
+
"""
|
|
91
|
+
Execute a transaction by processing the queued commands.
|
|
92
|
+
See https://valkey.io/docs/topics/transactions/ for details on Transactions.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
transaction (ClusterTransaction): A `ClusterTransaction` object containing a list of commands to be executed.
|
|
96
|
+
route (Optional[TSingleNodeRoute]): If `route` is not provided, the transaction will be routed to the slot owner of the
|
|
97
|
+
first key found in the transaction. If no key is found, the command will be sent to a random node.
|
|
98
|
+
If `route` is provided, the client will route the command to the nodes defined by `route`.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Optional[List[TResult]]: A list of results corresponding to the execution of each command
|
|
102
|
+
in the transaction. If a command returns a value, it will be included in the list. If a command
|
|
103
|
+
doesn't return a value, the list entry will be `None`.
|
|
104
|
+
If the transaction failed due to a WATCH command, `exec` will return `None`.
|
|
105
|
+
"""
|
|
106
|
+
commands = transaction.commands[:]
|
|
107
|
+
return await self._execute_transaction(commands, route)
|
|
108
|
+
|
|
109
|
+
async def config_resetstat(
|
|
110
|
+
self,
|
|
111
|
+
route: Optional[Route] = None,
|
|
112
|
+
) -> TOK:
|
|
113
|
+
"""
|
|
114
|
+
Resets the statistics reported by the server using the INFO and LATENCY HISTOGRAM commands.
|
|
115
|
+
See https://valkey.io/commands/config-resetstat/ for details.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
route (Optional[Route]): The command will be routed automatically to all nodes, unless `route` is provided, in which
|
|
119
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
OK: Returns "OK" to confirm that the statistics were successfully reset.
|
|
123
|
+
"""
|
|
124
|
+
return cast(
|
|
125
|
+
TOK, await self._execute_command(RequestType.ConfigResetStat, [], route)
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
async def config_rewrite(
|
|
129
|
+
self,
|
|
130
|
+
route: Optional[Route] = None,
|
|
131
|
+
) -> TOK:
|
|
132
|
+
"""
|
|
133
|
+
Rewrite the configuration file with the current configuration.
|
|
134
|
+
See https://valkey.io/commands/config-rewrite/ for details.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
route (Optional[TRoute]): The command will be routed automatically to all nodes, unless `route` is provided, in which
|
|
138
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
OK: OK is returned when the configuration was rewritten properly. Otherwise an error is raised.
|
|
142
|
+
|
|
143
|
+
Example:
|
|
144
|
+
>>> await client.config_rewrite()
|
|
145
|
+
'OK'
|
|
146
|
+
"""
|
|
147
|
+
return cast(
|
|
148
|
+
TOK, await self._execute_command(RequestType.ConfigRewrite, [], route)
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
async def client_id(
|
|
152
|
+
self,
|
|
153
|
+
route: Optional[Route] = None,
|
|
154
|
+
) -> TClusterResponse[int]:
|
|
155
|
+
"""
|
|
156
|
+
Returns the current connection id.
|
|
157
|
+
See https://valkey.io/commands/client-id/ for more information.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
route (Optional[Route]): The command will be sent to a random node, unless `route` is provided, in which
|
|
161
|
+
case the client will route the command to the nodes defined by `route`.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
TClusterResponse[int]: The id of the client.
|
|
165
|
+
If a single node route is requested, returns a int representing the client's id.
|
|
166
|
+
Otherwise, returns a dict of [byte , int] where each key contains the address of
|
|
167
|
+
the queried node and the value contains the client's id.
|
|
168
|
+
"""
|
|
169
|
+
return cast(
|
|
170
|
+
TClusterResponse[int],
|
|
171
|
+
await self._execute_command(RequestType.ClientId, [], route),
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
async def ping(
|
|
175
|
+
self, message: Optional[TEncodable] = None, route: Optional[Route] = None
|
|
176
|
+
) -> bytes:
|
|
177
|
+
"""
|
|
178
|
+
Ping the server.
|
|
179
|
+
See https://valkey.io/commands/ping/ for more details.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
message (Optional[TEncodable]): An optional message to include in the PING command. If not provided,
|
|
183
|
+
the server will respond with b"PONG". If provided, the server will respond with a copy of the message.
|
|
184
|
+
|
|
185
|
+
route (Optional[Route]): The command will be sent to all primaries, unless `route` is provided, in which
|
|
186
|
+
case the client will route the command to the nodes defined by `route`
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
bytes: b'PONG' if `message` is not provided, otherwise return a copy of `message`.
|
|
190
|
+
|
|
191
|
+
Examples:
|
|
192
|
+
>>> await client.ping()
|
|
193
|
+
b"PONG"
|
|
194
|
+
>>> await client.ping("Hello")
|
|
195
|
+
b"Hello"
|
|
196
|
+
"""
|
|
197
|
+
argument = [] if message is None else [message]
|
|
198
|
+
return cast(
|
|
199
|
+
bytes, await self._execute_command(RequestType.Ping, argument, route)
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
async def config_get(
|
|
203
|
+
self, parameters: List[TEncodable], route: Optional[Route] = None
|
|
204
|
+
) -> TClusterResponse[Dict[bytes, bytes]]:
|
|
205
|
+
"""
|
|
206
|
+
Get the values of configuration parameters.
|
|
207
|
+
Starting from server version 7, command supports multiple parameters.
|
|
208
|
+
See https://valkey.io/commands/config-get/ for details.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
parameters (List[TEncodable]): A list of configuration parameter names to retrieve values for.
|
|
212
|
+
|
|
213
|
+
route (Optional[Route]): The command will be routed to a random node, unless `route` is provided,
|
|
214
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
215
|
+
|
|
216
|
+
Returns:
|
|
217
|
+
TClusterResponse[Dict[bytes, bytes]]: A dictionary of values corresponding to the
|
|
218
|
+
configuration parameters.
|
|
219
|
+
When specifying a route other than a single node, response will be : {Address (bytes) : response (Dict[bytes, bytes]) , ... }
|
|
220
|
+
with type of Dict[bytes, Dict[bytes, bytes]].
|
|
221
|
+
|
|
222
|
+
Examples:
|
|
223
|
+
>>> await client.config_get(["timeout"] , RandomNode())
|
|
224
|
+
{b'timeout': b'1000'}
|
|
225
|
+
>>> await client.config_get(["timeout" , b"maxmemory"])
|
|
226
|
+
{b'timeout': b'1000', b"maxmemory": b"1GB"}
|
|
227
|
+
"""
|
|
228
|
+
return cast(
|
|
229
|
+
TClusterResponse[Dict[bytes, bytes]],
|
|
230
|
+
await self._execute_command(RequestType.ConfigGet, parameters, route),
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
async def config_set(
|
|
234
|
+
self,
|
|
235
|
+
parameters_map: Mapping[TEncodable, TEncodable],
|
|
236
|
+
route: Optional[Route] = None,
|
|
237
|
+
) -> TOK:
|
|
238
|
+
"""
|
|
239
|
+
Set configuration parameters to the specified values.
|
|
240
|
+
Starting from server version 7, command supports multiple parameters.
|
|
241
|
+
See https://valkey.io/commands/config-set/ for details.
|
|
242
|
+
|
|
243
|
+
Args:
|
|
244
|
+
parameters_map (Mapping[TEncodable, TEncodable]): A map consisting of configuration
|
|
245
|
+
parameters and their respective values to set.
|
|
246
|
+
|
|
247
|
+
route (Optional[Route]): The command will be routed to all nodes, unless `route` is provided,
|
|
248
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
249
|
+
|
|
250
|
+
Returns:
|
|
251
|
+
OK: Returns OK if all configurations have been successfully set. Otherwise, raises an error.
|
|
252
|
+
|
|
253
|
+
Examples:
|
|
254
|
+
>>> await client.config_set({"timeout": "1000", b"maxmemory": b"1GB"})
|
|
255
|
+
OK
|
|
256
|
+
"""
|
|
257
|
+
parameters: List[TEncodable] = []
|
|
258
|
+
for pair in parameters_map.items():
|
|
259
|
+
parameters.extend(pair)
|
|
260
|
+
return cast(
|
|
261
|
+
TOK,
|
|
262
|
+
await self._execute_command(RequestType.ConfigSet, parameters, route),
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
async def client_getname(
|
|
266
|
+
self, route: Optional[Route] = None
|
|
267
|
+
) -> TClusterResponse[Optional[bytes]]:
|
|
268
|
+
"""
|
|
269
|
+
Get the name of the connection to which the request is routed.
|
|
270
|
+
See https://valkey.io/commands/client-getname/ for more details.
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
route (Optional[Route]): The command will be routed to a random node, unless `route` is provided,
|
|
274
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
TClusterResponse[Optional[bytes]]: The name of the client connection as a bytes string if a name is set,
|
|
278
|
+
or None if no name is assigned.
|
|
279
|
+
When specifying a route other than a single node, response will be:
|
|
280
|
+
{Address (bytes) : response (Optional[bytes]) , ... } with type of Dict[str, Optional[str]].
|
|
281
|
+
|
|
282
|
+
Examples:
|
|
283
|
+
>>> await client.client_getname()
|
|
284
|
+
b'Connection Name'
|
|
285
|
+
>>> await client.client_getname(AllNodes())
|
|
286
|
+
{b'addr': b'Connection Name', b'addr2': b'Connection Name', b'addr3': b'Connection Name'}
|
|
287
|
+
"""
|
|
288
|
+
return cast(
|
|
289
|
+
TClusterResponse[Optional[bytes]],
|
|
290
|
+
await self._execute_command(RequestType.ClientGetName, [], route),
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
async def dbsize(self, route: Optional[Route] = None) -> int:
|
|
294
|
+
"""
|
|
295
|
+
Returns the number of keys in the database.
|
|
296
|
+
See https://valkey.io/commands/dbsize for more details.
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
route (Optional[Route]): The command will be routed to all primaries, unless `route` is provided,
|
|
300
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
301
|
+
|
|
302
|
+
Returns:
|
|
303
|
+
int: The number of keys in the database.
|
|
304
|
+
In the case of routing the query to multiple nodes, returns the aggregated number of keys across the different nodes.
|
|
305
|
+
|
|
306
|
+
Examples:
|
|
307
|
+
>>> await client.dbsize()
|
|
308
|
+
10 # Indicates there are 10 keys in the cluster.
|
|
309
|
+
"""
|
|
310
|
+
return cast(int, await self._execute_command(RequestType.DBSize, [], route))
|
|
311
|
+
|
|
312
|
+
async def echo(
|
|
313
|
+
self, message: TEncodable, route: Optional[Route] = None
|
|
314
|
+
) -> TClusterResponse[bytes]:
|
|
315
|
+
"""
|
|
316
|
+
Echoes the provided `message` back.
|
|
317
|
+
|
|
318
|
+
See https://valkey.io/commands/echo for more details.
|
|
319
|
+
|
|
320
|
+
Args:
|
|
321
|
+
message (TEncodable): The message to be echoed back.
|
|
322
|
+
route (Optional[Route]): The command will be routed to a random node, unless `route` is provided,
|
|
323
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
324
|
+
|
|
325
|
+
Returns:
|
|
326
|
+
TClusterResponse[bytes]: The provided `message`.
|
|
327
|
+
When specifying a route other than a single node, response will be:
|
|
328
|
+
{Address (bytes) : response (bytes) , ... } with type of Dict[bytes, bytes].
|
|
329
|
+
|
|
330
|
+
Examples:
|
|
331
|
+
>>> await client.echo(b"Valkey GLIDE")
|
|
332
|
+
b'Valkey GLIDE'
|
|
333
|
+
>>> await client.echo("Valkey GLIDE", AllNodes())
|
|
334
|
+
{b'addr': b'Valkey GLIDE', b'addr2': b'Valkey GLIDE', b'addr3': b'Valkey GLIDE'}
|
|
335
|
+
"""
|
|
336
|
+
return cast(
|
|
337
|
+
TClusterResponse[bytes],
|
|
338
|
+
await self._execute_command(RequestType.Echo, [message], route),
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
async def function_load(
|
|
342
|
+
self,
|
|
343
|
+
library_code: TEncodable,
|
|
344
|
+
replace: bool = False,
|
|
345
|
+
route: Optional[Route] = None,
|
|
346
|
+
) -> bytes:
|
|
347
|
+
"""
|
|
348
|
+
Loads a library to Valkey.
|
|
349
|
+
|
|
350
|
+
See https://valkey.io/commands/function-load/ for more details.
|
|
351
|
+
|
|
352
|
+
Args:
|
|
353
|
+
library_code (TEncodable): The source code that implements the library.
|
|
354
|
+
replace (bool): Whether the given library should overwrite a library with the same name if
|
|
355
|
+
it already exists.
|
|
356
|
+
route (Optional[Route]): The command will be routed to all primaries, unless `route` is provided,
|
|
357
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
358
|
+
|
|
359
|
+
Returns:
|
|
360
|
+
bytes: The library name that was loaded.
|
|
361
|
+
|
|
362
|
+
Examples:
|
|
363
|
+
>>> code = "#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)"
|
|
364
|
+
>>> await client.function_load(code, True, RandomNode())
|
|
365
|
+
b"mylib"
|
|
366
|
+
|
|
367
|
+
Since: Valkey 7.0.0.
|
|
368
|
+
"""
|
|
369
|
+
return cast(
|
|
370
|
+
bytes,
|
|
371
|
+
await self._execute_command(
|
|
372
|
+
RequestType.FunctionLoad,
|
|
373
|
+
["REPLACE", library_code] if replace else [library_code],
|
|
374
|
+
route,
|
|
375
|
+
),
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
async def function_list(
|
|
379
|
+
self,
|
|
380
|
+
library_name_pattern: Optional[TEncodable] = None,
|
|
381
|
+
with_code: bool = False,
|
|
382
|
+
route: Optional[Route] = None,
|
|
383
|
+
) -> TClusterResponse[TFunctionListResponse]:
|
|
384
|
+
"""
|
|
385
|
+
Returns information about the functions and libraries.
|
|
386
|
+
|
|
387
|
+
See https://valkey.io/commands/function-list/ for more details.
|
|
388
|
+
|
|
389
|
+
Args:
|
|
390
|
+
library_name_pattern (Optional[TEncodable]): A wildcard pattern for matching library names.
|
|
391
|
+
with_code (bool): Specifies whether to request the library code from the server or not.
|
|
392
|
+
route (Optional[Route]): The command will be routed to a random node, unless `route` is provided,
|
|
393
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
394
|
+
|
|
395
|
+
Returns:
|
|
396
|
+
TClusterResponse[TFunctionListResponse]: Info
|
|
397
|
+
about all or selected libraries and their functions.
|
|
398
|
+
|
|
399
|
+
Examples:
|
|
400
|
+
>>> response = await client.function_list("myLib?_backup", True)
|
|
401
|
+
[{
|
|
402
|
+
b"library_name": b"myLib5_backup",
|
|
403
|
+
b"engine": b"LUA",
|
|
404
|
+
b"functions": [{
|
|
405
|
+
b"name": b"myfunc",
|
|
406
|
+
b"description": None,
|
|
407
|
+
b"flags": {b"no-writes"},
|
|
408
|
+
}],
|
|
409
|
+
b"library_code": b"#!lua name=mylib \n redis.register_function('myfunc', function(keys, args) return args[1] end)"
|
|
410
|
+
}]
|
|
411
|
+
|
|
412
|
+
Since: Valkey 7.0.0.
|
|
413
|
+
"""
|
|
414
|
+
args = []
|
|
415
|
+
if library_name_pattern is not None:
|
|
416
|
+
args.extend(["LIBRARYNAME", library_name_pattern])
|
|
417
|
+
if with_code:
|
|
418
|
+
args.append("WITHCODE")
|
|
419
|
+
return cast(
|
|
420
|
+
TClusterResponse[TFunctionListResponse],
|
|
421
|
+
await self._execute_command(
|
|
422
|
+
RequestType.FunctionList,
|
|
423
|
+
args,
|
|
424
|
+
route,
|
|
425
|
+
),
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
async def function_flush(
|
|
429
|
+
self, mode: Optional[FlushMode] = None, route: Optional[Route] = None
|
|
430
|
+
) -> TOK:
|
|
431
|
+
"""
|
|
432
|
+
Deletes all function libraries.
|
|
433
|
+
|
|
434
|
+
See https://valkey.io/commands/function-flush/ for more details.
|
|
435
|
+
|
|
436
|
+
Args:
|
|
437
|
+
mode (Optional[FlushMode]): The flushing mode, could be either `SYNC` or `ASYNC`.
|
|
438
|
+
route (Optional[Route]): The command will be routed to all primaries, unless `route` is provided,
|
|
439
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
440
|
+
|
|
441
|
+
Returns:
|
|
442
|
+
TOK: A simple `OK`.
|
|
443
|
+
|
|
444
|
+
Examples:
|
|
445
|
+
>>> await client.function_flush(FlushMode.SYNC)
|
|
446
|
+
"OK"
|
|
447
|
+
|
|
448
|
+
Since: Valkey 7.0.0.
|
|
449
|
+
"""
|
|
450
|
+
return cast(
|
|
451
|
+
TOK,
|
|
452
|
+
await self._execute_command(
|
|
453
|
+
RequestType.FunctionFlush,
|
|
454
|
+
[mode.value] if mode else [],
|
|
455
|
+
route,
|
|
456
|
+
),
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
async def function_delete(
|
|
460
|
+
self, library_name: TEncodable, route: Optional[Route] = None
|
|
461
|
+
) -> TOK:
|
|
462
|
+
"""
|
|
463
|
+
Deletes a library and all its functions.
|
|
464
|
+
|
|
465
|
+
See https://valkey.io/commands/function-delete/ for more details.
|
|
466
|
+
|
|
467
|
+
Args:
|
|
468
|
+
library_code (TEncodable): The library name to delete
|
|
469
|
+
route (Optional[Route]): The command will be routed to all primaries, unless `route` is provided,
|
|
470
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
471
|
+
|
|
472
|
+
Returns:
|
|
473
|
+
TOK: A simple `OK`.
|
|
474
|
+
|
|
475
|
+
Examples:
|
|
476
|
+
>>> await client.function_delete("my_lib")
|
|
477
|
+
"OK"
|
|
478
|
+
|
|
479
|
+
Since: Valkey 7.0.0.
|
|
480
|
+
"""
|
|
481
|
+
return cast(
|
|
482
|
+
TOK,
|
|
483
|
+
await self._execute_command(
|
|
484
|
+
RequestType.FunctionDelete,
|
|
485
|
+
[library_name],
|
|
486
|
+
route,
|
|
487
|
+
),
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
async def function_kill(self, route: Optional[Route] = None) -> TOK:
|
|
491
|
+
"""
|
|
492
|
+
Kills a function that is currently executing.
|
|
493
|
+
This command only terminates read-only functions.
|
|
494
|
+
|
|
495
|
+
See https://valkey.io/commands/function-kill/ for more details.
|
|
496
|
+
|
|
497
|
+
Args:
|
|
498
|
+
route (Optional[Route]): The command will be routed to all nodes, unless `route` is provided,
|
|
499
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
500
|
+
|
|
501
|
+
Returns:
|
|
502
|
+
TOK: A simple `OK`.
|
|
503
|
+
|
|
504
|
+
Examples:
|
|
505
|
+
>>> await client.function_kill()
|
|
506
|
+
"OK"
|
|
507
|
+
|
|
508
|
+
Since: Valkey 7.0.0.
|
|
509
|
+
"""
|
|
510
|
+
return cast(
|
|
511
|
+
TOK,
|
|
512
|
+
await self._execute_command(
|
|
513
|
+
RequestType.FunctionKill,
|
|
514
|
+
[],
|
|
515
|
+
route,
|
|
516
|
+
),
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
async def fcall_route(
|
|
520
|
+
self,
|
|
521
|
+
function: TEncodable,
|
|
522
|
+
arguments: Optional[List[TEncodable]] = None,
|
|
523
|
+
route: Optional[Route] = None,
|
|
524
|
+
) -> TClusterResponse[TResult]:
|
|
525
|
+
"""
|
|
526
|
+
Invokes a previously loaded function.
|
|
527
|
+
See https://valkey.io/commands/fcall/ for more details.
|
|
528
|
+
|
|
529
|
+
Args:
|
|
530
|
+
function (TEncodable): The function name.
|
|
531
|
+
arguments (Optional[List[TEncodable]]): A list of `function` arguments. `Arguments`
|
|
532
|
+
should not represent names of keys.
|
|
533
|
+
route (Optional[Route]): The command will be routed to a random primary node, unless `route` is provided, in which
|
|
534
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
535
|
+
|
|
536
|
+
Returns:
|
|
537
|
+
TClusterResponse[TResult]:
|
|
538
|
+
If a single node route is requested, returns a Optional[TResult] representing the function's return value.
|
|
539
|
+
Otherwise, returns a dict of [bytes , Optional[TResult]] where each key contains the address of
|
|
540
|
+
the queried node and the value contains the function's return value.
|
|
541
|
+
|
|
542
|
+
Example:
|
|
543
|
+
>>> await client.fcall("Deep_Thought", ["Answer", "to", "the", "Ultimate", "Question", "of", "Life,", "the", "Universe,", "and", "Everything"], RandomNode())
|
|
544
|
+
b'new_value' # Returns the function's return value.
|
|
545
|
+
|
|
546
|
+
Since: Valkey version 7.0.0.
|
|
547
|
+
"""
|
|
548
|
+
args = [function, "0"]
|
|
549
|
+
if arguments is not None:
|
|
550
|
+
args.extend(arguments)
|
|
551
|
+
return cast(
|
|
552
|
+
TClusterResponse[TResult],
|
|
553
|
+
await self._execute_command(RequestType.FCall, args, route),
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
async def fcall_ro_route(
|
|
557
|
+
self,
|
|
558
|
+
function: TEncodable,
|
|
559
|
+
arguments: Optional[List[TEncodable]] = None,
|
|
560
|
+
route: Optional[Route] = None,
|
|
561
|
+
) -> TClusterResponse[TResult]:
|
|
562
|
+
"""
|
|
563
|
+
Invokes a previously loaded read-only function.
|
|
564
|
+
|
|
565
|
+
See https://valkey.io/commands/fcall_ro for more details.
|
|
566
|
+
|
|
567
|
+
Args:
|
|
568
|
+
function (TEncodable): The function name.
|
|
569
|
+
arguments (List[TEncodable]): An `array` of `function` arguments. `arguments` should not
|
|
570
|
+
represent names of keys.
|
|
571
|
+
route (Optional[Route]): Specifies the routing configuration of the command. The client
|
|
572
|
+
will route the command to the nodes defined by `route`.
|
|
573
|
+
|
|
574
|
+
Returns:
|
|
575
|
+
TClusterResponse[TResult]: The return value depends on the function that was executed.
|
|
576
|
+
|
|
577
|
+
Examples:
|
|
578
|
+
>>> await client.fcall_ro_route("Deep_Thought", ALL_NODES)
|
|
579
|
+
42 # The return value on the function that was executed
|
|
580
|
+
|
|
581
|
+
Since: Valkey version 7.0.0.
|
|
582
|
+
"""
|
|
583
|
+
args: List[TEncodable] = [function, "0"]
|
|
584
|
+
if arguments is not None:
|
|
585
|
+
args.extend(arguments)
|
|
586
|
+
return cast(
|
|
587
|
+
TClusterResponse[TResult],
|
|
588
|
+
await self._execute_command(RequestType.FCallReadOnly, args, route),
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
async def function_stats(
|
|
592
|
+
self, route: Optional[Route] = None
|
|
593
|
+
) -> TClusterResponse[TFunctionStatsSingleNodeResponse]:
|
|
594
|
+
"""
|
|
595
|
+
Returns information about the function that's currently running and information about the
|
|
596
|
+
available execution engines.
|
|
597
|
+
|
|
598
|
+
See https://valkey.io/commands/function-stats/ for more details
|
|
599
|
+
|
|
600
|
+
Args:
|
|
601
|
+
route (Optional[Route]): The command will be routed automatically to all nodes, unless `route` is provided, in which
|
|
602
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
603
|
+
|
|
604
|
+
Returns:
|
|
605
|
+
TClusterResponse[TFunctionStatsSingleNodeResponse]: A `Mapping` with two keys:
|
|
606
|
+
- `running_script` with information about the running script.
|
|
607
|
+
- `engines` with information about available engines and their stats.
|
|
608
|
+
See example for more details.
|
|
609
|
+
|
|
610
|
+
Examples:
|
|
611
|
+
>>> await client.function_stats(RandomNode())
|
|
612
|
+
{
|
|
613
|
+
'running_script': {
|
|
614
|
+
'name': 'foo',
|
|
615
|
+
'command': ['FCALL', 'foo', '0', 'hello'],
|
|
616
|
+
'duration_ms': 7758
|
|
617
|
+
},
|
|
618
|
+
'engines': {
|
|
619
|
+
'LUA': {
|
|
620
|
+
'libraries_count': 1,
|
|
621
|
+
'functions_count': 1,
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
Since: Valkey version 7.0.0.
|
|
627
|
+
"""
|
|
628
|
+
return cast(
|
|
629
|
+
TClusterResponse[TFunctionStatsSingleNodeResponse],
|
|
630
|
+
await self._execute_command(RequestType.FunctionStats, [], route),
|
|
631
|
+
)
|
|
632
|
+
|
|
633
|
+
async def function_dump(
|
|
634
|
+
self, route: Optional[Route] = None
|
|
635
|
+
) -> TClusterResponse[bytes]:
|
|
636
|
+
"""
|
|
637
|
+
Returns the serialized payload of all loaded libraries.
|
|
638
|
+
|
|
639
|
+
See https://valkey.io/commands/function-dump/ for more details.
|
|
640
|
+
|
|
641
|
+
Args:
|
|
642
|
+
route (Optional[Route]): The command will be routed to a random node, unless
|
|
643
|
+
`route` is provided, in which case the client will route the command to the
|
|
644
|
+
nodes defined by `route`.
|
|
645
|
+
|
|
646
|
+
Returns:
|
|
647
|
+
TClusterResponse[bytes]: The serialized payload of all loaded libraries.
|
|
648
|
+
|
|
649
|
+
Examples:
|
|
650
|
+
>>> payload = await client.function_dump()
|
|
651
|
+
# The serialized payload of all loaded libraries. This response can
|
|
652
|
+
# be used to restore loaded functions on any Valkey instance.
|
|
653
|
+
>>> await client.function_restore(payload)
|
|
654
|
+
"OK" # The serialized dump response was used to restore the libraries.
|
|
655
|
+
|
|
656
|
+
Since: Valkey 7.0.0.
|
|
657
|
+
"""
|
|
658
|
+
return cast(
|
|
659
|
+
TClusterResponse[bytes],
|
|
660
|
+
await self._execute_command(RequestType.FunctionDump, [], route),
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
async def function_restore(
|
|
664
|
+
self,
|
|
665
|
+
payload: TEncodable,
|
|
666
|
+
policy: Optional[FunctionRestorePolicy] = None,
|
|
667
|
+
route: Optional[Route] = None,
|
|
668
|
+
) -> TOK:
|
|
669
|
+
"""
|
|
670
|
+
Restores libraries from the serialized payload returned by the `function_dump` command.
|
|
671
|
+
|
|
672
|
+
See https://valkey.io/commands/function-restore/ for more details.
|
|
673
|
+
|
|
674
|
+
Args:
|
|
675
|
+
payload (bytes): The serialized data from the `function_dump` command.
|
|
676
|
+
policy (Optional[FunctionRestorePolicy]): A policy for handling existing libraries.
|
|
677
|
+
route (Optional[Route]): The command will be sent to all primaries, unless
|
|
678
|
+
`route` is provided, in which case the client will route the command to the
|
|
679
|
+
nodes defined by `route`.
|
|
680
|
+
|
|
681
|
+
Returns:
|
|
682
|
+
TOK: OK.
|
|
683
|
+
|
|
684
|
+
Examples:
|
|
685
|
+
>>> payload = await client.function_dump()
|
|
686
|
+
# The serialized payload of all loaded libraries. This response can
|
|
687
|
+
# be used to restore loaded functions on any Valkey instance.
|
|
688
|
+
>>> await client.function_restore(payload, AllPrimaries())
|
|
689
|
+
"OK" # The serialized dump response was used to restore the libraries with the specified route.
|
|
690
|
+
>>> await client.function_restore(payload, FunctionRestorePolicy.FLUSH, AllPrimaries())
|
|
691
|
+
"OK" # The serialized dump response was used to restore the libraries with the specified route and policy.
|
|
692
|
+
|
|
693
|
+
Since: Valkey 7.0.0.
|
|
694
|
+
"""
|
|
695
|
+
args: List[TEncodable] = [payload]
|
|
696
|
+
if policy is not None:
|
|
697
|
+
args.append(policy.value)
|
|
698
|
+
|
|
699
|
+
return cast(
|
|
700
|
+
TOK, await self._execute_command(RequestType.FunctionRestore, args, route)
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
async def time(
|
|
704
|
+
self, route: Optional[Route] = None
|
|
705
|
+
) -> TClusterResponse[List[bytes]]:
|
|
706
|
+
"""
|
|
707
|
+
Returns the server time.
|
|
708
|
+
|
|
709
|
+
See https://valkey.io/commands/time/ for more details.
|
|
710
|
+
|
|
711
|
+
Args:
|
|
712
|
+
route (Optional[Route]): The command will be routed to a random node, unless `route` is provided,
|
|
713
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
714
|
+
|
|
715
|
+
Returns:
|
|
716
|
+
TClusterResponse[Optional[bytes]]: The current server time as a two items `array`:
|
|
717
|
+
A Unix timestamp and the amount of microseconds already elapsed in the current second.
|
|
718
|
+
The returned `array` is in a [Unix timestamp, Microseconds already elapsed] format.
|
|
719
|
+
When specifying a route other than a single node, response will be:
|
|
720
|
+
{Address (bytes) : response (List[bytes]) , ... } with type of Dict[bytes, List[bytes]].
|
|
721
|
+
|
|
722
|
+
Examples:
|
|
723
|
+
>>> await client.time()
|
|
724
|
+
[b'1710925775', b'913580']
|
|
725
|
+
>>> await client.time(AllNodes())
|
|
726
|
+
{b'addr': [b'1710925775', b'913580'], b'addr2': [b'1710925775', b'913580'], b'addr3': [b'1710925775', b'913580']}
|
|
727
|
+
"""
|
|
728
|
+
return cast(
|
|
729
|
+
TClusterResponse[List[bytes]],
|
|
730
|
+
await self._execute_command(RequestType.Time, [], route),
|
|
731
|
+
)
|
|
732
|
+
|
|
733
|
+
async def lastsave(self, route: Optional[Route] = None) -> TClusterResponse[int]:
|
|
734
|
+
"""
|
|
735
|
+
Returns the Unix time of the last DB save timestamp or startup timestamp if no save was made since then.
|
|
736
|
+
|
|
737
|
+
See https://valkey.io/commands/lastsave for more details.
|
|
738
|
+
|
|
739
|
+
Args:
|
|
740
|
+
route (Optional[Route]): The command will be routed to a random node, unless `route` is provided,
|
|
741
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
742
|
+
|
|
743
|
+
Returns:
|
|
744
|
+
TClusterResponse[int]: The Unix time of the last successful DB save.
|
|
745
|
+
If no route is provided, or a single node route is requested, returns an int representing the Unix time
|
|
746
|
+
of the last successful DB save. Otherwise, returns a dict of [bytes , int] where each key contains the
|
|
747
|
+
address of the queried node and the value contains the Unix time of the last successful DB save.
|
|
748
|
+
|
|
749
|
+
Examples:
|
|
750
|
+
>>> await client.lastsave()
|
|
751
|
+
1710925775 # Unix time of the last DB save
|
|
752
|
+
>>> await client.lastsave(AllNodes())
|
|
753
|
+
{b'addr1': 1710925775, b'addr2': 1710925775, b'addr3': 1710925775} # Unix time of the last DB save on each node
|
|
754
|
+
"""
|
|
755
|
+
return cast(
|
|
756
|
+
TClusterResponse[int],
|
|
757
|
+
await self._execute_command(RequestType.LastSave, [], route),
|
|
758
|
+
)
|
|
759
|
+
|
|
760
|
+
async def publish(
|
|
761
|
+
self,
|
|
762
|
+
message: TEncodable,
|
|
763
|
+
channel: TEncodable,
|
|
764
|
+
sharded: bool = False,
|
|
765
|
+
) -> int:
|
|
766
|
+
"""
|
|
767
|
+
Publish a message on pubsub channel.
|
|
768
|
+
This command aggregates PUBLISH and SPUBLISH commands functionalities.
|
|
769
|
+
The mode is selected using the 'sharded' parameter.
|
|
770
|
+
For both sharded and non-sharded mode, request is routed using hashed channel as key.
|
|
771
|
+
See https://valkey.io/commands/publish and https://valkey.io/commands/spublish for more details.
|
|
772
|
+
|
|
773
|
+
Args:
|
|
774
|
+
message (TEncodable): Message to publish.
|
|
775
|
+
channel (TEncodable): Channel to publish the message on.
|
|
776
|
+
sharded (bool): Use sharded pubsub mode. Available since Valkey version 7.0.
|
|
777
|
+
|
|
778
|
+
Returns:
|
|
779
|
+
int: Number of subscriptions in that node that received the message.
|
|
780
|
+
|
|
781
|
+
Examples:
|
|
782
|
+
>>> await client.publish("Hi all!", "global-channel", False)
|
|
783
|
+
1 # Published 1 instance of "Hi all!" message on global-channel channel using non-sharded mode
|
|
784
|
+
>>> await client.publish(b"Hi to sharded channel1!", b"channel1", True)
|
|
785
|
+
2 # Published 2 instances of "Hi to sharded channel1!" message on channel1 using sharded mode
|
|
786
|
+
"""
|
|
787
|
+
result = await self._execute_command(
|
|
788
|
+
RequestType.SPublish if sharded else RequestType.Publish, [channel, message]
|
|
789
|
+
)
|
|
790
|
+
return cast(int, result)
|
|
791
|
+
|
|
792
|
+
async def pubsub_shardchannels(
|
|
793
|
+
self, pattern: Optional[TEncodable] = None
|
|
794
|
+
) -> List[bytes]:
|
|
795
|
+
"""
|
|
796
|
+
Lists the currently active shard channels.
|
|
797
|
+
The command is routed to all nodes, and aggregates the response to a single array.
|
|
798
|
+
|
|
799
|
+
See https://valkey.io/commands/pubsub-shardchannels for more details.
|
|
800
|
+
|
|
801
|
+
Args:
|
|
802
|
+
pattern (Optional[TEncodable]): A glob-style pattern to match active shard channels.
|
|
803
|
+
If not provided, all active shard channels are returned.
|
|
804
|
+
|
|
805
|
+
Returns:
|
|
806
|
+
List[bytes]: A list of currently active shard channels matching the given pattern.
|
|
807
|
+
If no pattern is specified, all active shard channels are returned.
|
|
808
|
+
|
|
809
|
+
Examples:
|
|
810
|
+
>>> await client.pubsub_shardchannels()
|
|
811
|
+
[b'channel1', b'channel2']
|
|
812
|
+
|
|
813
|
+
>>> await client.pubsub_shardchannels("channel*")
|
|
814
|
+
[b'channel1', b'channel2']
|
|
815
|
+
"""
|
|
816
|
+
command_args = [pattern] if pattern is not None else []
|
|
817
|
+
return cast(
|
|
818
|
+
List[bytes],
|
|
819
|
+
await self._execute_command(RequestType.PubSubShardChannels, command_args),
|
|
820
|
+
)
|
|
821
|
+
|
|
822
|
+
async def pubsub_shardnumsub(
|
|
823
|
+
self, channels: Optional[List[TEncodable]] = None
|
|
824
|
+
) -> Mapping[bytes, int]:
|
|
825
|
+
"""
|
|
826
|
+
Returns the number of subscribers (exclusive of clients subscribed to patterns) for the specified shard channels.
|
|
827
|
+
|
|
828
|
+
Note that it is valid to call this command without channels. In this case, it will just return an empty map.
|
|
829
|
+
The command is routed to all nodes, and aggregates the response to a single map of the channels and their number of subscriptions.
|
|
830
|
+
|
|
831
|
+
See https://valkey.io/commands/pubsub-shardnumsub for more details.
|
|
832
|
+
|
|
833
|
+
Args:
|
|
834
|
+
channels (Optional[List[TEncodable]]): The list of shard channels to query for the number of subscribers.
|
|
835
|
+
If not provided, returns an empty map.
|
|
836
|
+
|
|
837
|
+
Returns:
|
|
838
|
+
Mapping[bytes, int]: A map where keys are the shard channel names and values are the number of subscribers.
|
|
839
|
+
|
|
840
|
+
Examples:
|
|
841
|
+
>>> await client.pubsub_shardnumsub(["channel1", "channel2"])
|
|
842
|
+
{b'channel1': 3, b'channel2': 5}
|
|
843
|
+
|
|
844
|
+
>>> await client.pubsub_shardnumsub()
|
|
845
|
+
{}
|
|
846
|
+
"""
|
|
847
|
+
return cast(
|
|
848
|
+
Mapping[bytes, int],
|
|
849
|
+
await self._execute_command(
|
|
850
|
+
RequestType.PubSubShardNumSub, channels if channels else []
|
|
851
|
+
),
|
|
852
|
+
)
|
|
853
|
+
|
|
854
|
+
async def flushall(
|
|
855
|
+
self, flush_mode: Optional[FlushMode] = None, route: Optional[Route] = None
|
|
856
|
+
) -> TOK:
|
|
857
|
+
"""
|
|
858
|
+
Deletes all the keys of all the existing databases. This command never fails.
|
|
859
|
+
|
|
860
|
+
See https://valkey.io/commands/flushall for more details.
|
|
861
|
+
|
|
862
|
+
Args:
|
|
863
|
+
flush_mode (Optional[FlushMode]): The flushing mode, could be either `SYNC` or `ASYNC`.
|
|
864
|
+
route (Optional[Route]): The command will be routed to all primary nodes, unless `route` is provided,
|
|
865
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
866
|
+
|
|
867
|
+
Returns:
|
|
868
|
+
TOK: A simple OK response.
|
|
869
|
+
|
|
870
|
+
Examples:
|
|
871
|
+
>>> await client.flushall(FlushMode.ASYNC)
|
|
872
|
+
OK # This command never fails.
|
|
873
|
+
>>> await client.flushall(FlushMode.ASYNC, AllNodes())
|
|
874
|
+
OK # This command never fails.
|
|
875
|
+
"""
|
|
876
|
+
args: List[TEncodable] = []
|
|
877
|
+
if flush_mode is not None:
|
|
878
|
+
args.append(flush_mode.value)
|
|
879
|
+
|
|
880
|
+
return cast(
|
|
881
|
+
TOK,
|
|
882
|
+
await self._execute_command(RequestType.FlushAll, args, route),
|
|
883
|
+
)
|
|
884
|
+
|
|
885
|
+
async def flushdb(
|
|
886
|
+
self, flush_mode: Optional[FlushMode] = None, route: Optional[Route] = None
|
|
887
|
+
) -> TOK:
|
|
888
|
+
"""
|
|
889
|
+
Deletes all the keys of the currently selected database. This command never fails.
|
|
890
|
+
|
|
891
|
+
See https://valkey.io/commands/flushdb for more details.
|
|
892
|
+
|
|
893
|
+
Args:
|
|
894
|
+
flush_mode (Optional[FlushMode]): The flushing mode, could be either `SYNC` or `ASYNC`.
|
|
895
|
+
route (Optional[Route]): The command will be routed to all primary nodes, unless `route` is provided,
|
|
896
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
897
|
+
|
|
898
|
+
Returns:
|
|
899
|
+
TOK: A simple OK response.
|
|
900
|
+
|
|
901
|
+
Examples:
|
|
902
|
+
>>> await client.flushdb()
|
|
903
|
+
OK # The keys of the currently selected database were deleted.
|
|
904
|
+
>>> await client.flushdb(FlushMode.ASYNC)
|
|
905
|
+
OK # The keys of the currently selected database were deleted asynchronously.
|
|
906
|
+
>>> await client.flushdb(FlushMode.ASYNC, AllNodes())
|
|
907
|
+
OK # The keys of the currently selected database were deleted asynchronously on all nodes.
|
|
908
|
+
"""
|
|
909
|
+
args: List[TEncodable] = []
|
|
910
|
+
if flush_mode is not None:
|
|
911
|
+
args.append(flush_mode.value)
|
|
912
|
+
|
|
913
|
+
return cast(
|
|
914
|
+
TOK,
|
|
915
|
+
await self._execute_command(RequestType.FlushDB, args, route),
|
|
916
|
+
)
|
|
917
|
+
|
|
918
|
+
async def copy(
|
|
919
|
+
self,
|
|
920
|
+
source: TEncodable,
|
|
921
|
+
destination: TEncodable,
|
|
922
|
+
replace: Optional[bool] = None,
|
|
923
|
+
) -> bool:
|
|
924
|
+
"""
|
|
925
|
+
Copies the value stored at the `source` to the `destination` key. When `replace` is True,
|
|
926
|
+
removes the `destination` key first if it already exists, otherwise performs no action.
|
|
927
|
+
|
|
928
|
+
See https://valkey.io/commands/copy for more details.
|
|
929
|
+
|
|
930
|
+
Note:
|
|
931
|
+
Both `source` and `destination` must map to the same hash slot.
|
|
932
|
+
|
|
933
|
+
Args:
|
|
934
|
+
source (TEncodable): The key to the source value.
|
|
935
|
+
destination (TEncodable): The key where the value should be copied to.
|
|
936
|
+
replace (Optional[bool]): If the destination key should be removed before copying the value to it.
|
|
937
|
+
|
|
938
|
+
Returns:
|
|
939
|
+
bool: True if the source was copied. Otherwise, returns False.
|
|
940
|
+
|
|
941
|
+
Examples:
|
|
942
|
+
>>> await client.set("source", "sheep")
|
|
943
|
+
>>> await client.copy(b"source", b"destination")
|
|
944
|
+
True # Source was copied
|
|
945
|
+
>>> await client.get("destination")
|
|
946
|
+
b"sheep"
|
|
947
|
+
|
|
948
|
+
Since: Valkey version 6.2.0.
|
|
949
|
+
"""
|
|
950
|
+
args: List[TEncodable] = [source, destination]
|
|
951
|
+
if replace is True:
|
|
952
|
+
args.append("REPLACE")
|
|
953
|
+
return cast(
|
|
954
|
+
bool,
|
|
955
|
+
await self._execute_command(RequestType.Copy, args),
|
|
956
|
+
)
|
|
957
|
+
|
|
958
|
+
async def lolwut(
|
|
959
|
+
self,
|
|
960
|
+
version: Optional[int] = None,
|
|
961
|
+
parameters: Optional[List[int]] = None,
|
|
962
|
+
route: Optional[Route] = None,
|
|
963
|
+
) -> TClusterResponse[bytes]:
|
|
964
|
+
"""
|
|
965
|
+
Displays a piece of generative computer art and the Valkey version.
|
|
966
|
+
|
|
967
|
+
See https://valkey.io/commands/lolwut for more details.
|
|
968
|
+
|
|
969
|
+
Args:
|
|
970
|
+
version (Optional[int]): Version of computer art to generate.
|
|
971
|
+
parameters (Optional[List[int]]): Additional set of arguments in order to change the output:
|
|
972
|
+
For version `5`, those are length of the line, number of squares per row, and number of squares per column.
|
|
973
|
+
For version `6`, those are number of columns and number of lines.
|
|
974
|
+
route (Optional[Route]): The command will be routed to a random node, unless `route` is provided,
|
|
975
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
976
|
+
|
|
977
|
+
Returns:
|
|
978
|
+
TClusterResponse[bytes]: A piece of generative computer art along with the current Valkey version.
|
|
979
|
+
When specifying a route other than a single node, response will be:
|
|
980
|
+
{Address (bytes) : response (bytes) , ... } with type of Dict[bytes, bytes].
|
|
981
|
+
|
|
982
|
+
Examples:
|
|
983
|
+
>>> await client.lolwut(6, [40, 20], RandomNode());
|
|
984
|
+
b"Redis ver. 7.2.3" # Indicates the current Valkey version
|
|
985
|
+
"""
|
|
986
|
+
args: List[TEncodable] = []
|
|
987
|
+
if version is not None:
|
|
988
|
+
args.extend(["VERSION", str(version)])
|
|
989
|
+
if parameters:
|
|
990
|
+
for var in parameters:
|
|
991
|
+
args.extend(str(var))
|
|
992
|
+
return cast(
|
|
993
|
+
TClusterResponse[bytes],
|
|
994
|
+
await self._execute_command(RequestType.Lolwut, args, route),
|
|
995
|
+
)
|
|
996
|
+
|
|
997
|
+
async def random_key(self, route: Optional[Route] = None) -> Optional[bytes]:
|
|
998
|
+
"""
|
|
999
|
+
Returns a random existing key name.
|
|
1000
|
+
|
|
1001
|
+
See https://valkey.io/commands/randomkey for more details.
|
|
1002
|
+
|
|
1003
|
+
Args:
|
|
1004
|
+
route (Optional[Route]): The command will be routed to all primary nodes, unless `route` is provided,
|
|
1005
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
1006
|
+
|
|
1007
|
+
Returns:
|
|
1008
|
+
Optional[bytes]: A random existing key name.
|
|
1009
|
+
|
|
1010
|
+
Examples:
|
|
1011
|
+
>>> await client.random_key()
|
|
1012
|
+
b"random_key_name" # "random_key_name" is a random existing key name.
|
|
1013
|
+
"""
|
|
1014
|
+
return cast(
|
|
1015
|
+
Optional[bytes],
|
|
1016
|
+
await self._execute_command(RequestType.RandomKey, [], route),
|
|
1017
|
+
)
|
|
1018
|
+
|
|
1019
|
+
async def wait(
|
|
1020
|
+
self,
|
|
1021
|
+
numreplicas: int,
|
|
1022
|
+
timeout: int,
|
|
1023
|
+
route: Optional[Route] = None,
|
|
1024
|
+
) -> int:
|
|
1025
|
+
"""
|
|
1026
|
+
Blocks the current client until all the previous write commands are successfully transferred
|
|
1027
|
+
and acknowledged by at least `numreplicas` of replicas. If `timeout` is
|
|
1028
|
+
reached, the command returns even if the specified number of replicas were not yet reached.
|
|
1029
|
+
|
|
1030
|
+
See https://valkey.io/commands/wait for more details.
|
|
1031
|
+
|
|
1032
|
+
Args:
|
|
1033
|
+
numreplicas (int): The number of replicas to reach.
|
|
1034
|
+
timeout (int): The timeout value specified in milliseconds. A value of 0 will block indefinitely.
|
|
1035
|
+
route (Optional[Route]): The command will be routed to all primary nodes, unless `route` is provided,
|
|
1036
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
1037
|
+
|
|
1038
|
+
Returns:
|
|
1039
|
+
int: The number of replicas reached by all the writes performed in the context of the current connection.
|
|
1040
|
+
|
|
1041
|
+
Examples:
|
|
1042
|
+
>>> await client.set("key", "value");
|
|
1043
|
+
>>> await client.wait(1, 1000);
|
|
1044
|
+
// return 1 when a replica is reached or 0 if 1000ms is reached.
|
|
1045
|
+
"""
|
|
1046
|
+
args: List[TEncodable] = [str(numreplicas), str(timeout)]
|
|
1047
|
+
return cast(
|
|
1048
|
+
int,
|
|
1049
|
+
await self._execute_command(RequestType.Wait, args, route),
|
|
1050
|
+
)
|
|
1051
|
+
|
|
1052
|
+
async def unwatch(self, route: Optional[Route] = None) -> TOK:
|
|
1053
|
+
"""
|
|
1054
|
+
Flushes all the previously watched keys for a transaction. Executing a transaction will
|
|
1055
|
+
automatically flush all previously watched keys.
|
|
1056
|
+
|
|
1057
|
+
See https://valkey.io/commands/unwatch for more details.
|
|
1058
|
+
|
|
1059
|
+
Args:
|
|
1060
|
+
route (Optional[Route]): The command will be routed to all primary nodes, unless `route` is provided,
|
|
1061
|
+
in which case the client will route the command to the nodes defined by `route`.
|
|
1062
|
+
|
|
1063
|
+
Returns:
|
|
1064
|
+
TOK: A simple "OK" response.
|
|
1065
|
+
|
|
1066
|
+
Examples:
|
|
1067
|
+
>>> await client.unwatch()
|
|
1068
|
+
'OK'
|
|
1069
|
+
"""
|
|
1070
|
+
return cast(
|
|
1071
|
+
TOK,
|
|
1072
|
+
await self._execute_command(RequestType.UnWatch, [], route),
|
|
1073
|
+
)
|
|
1074
|
+
|
|
1075
|
+
async def scan(
|
|
1076
|
+
self,
|
|
1077
|
+
cursor: ClusterScanCursor,
|
|
1078
|
+
match: Optional[TEncodable] = None,
|
|
1079
|
+
count: Optional[int] = None,
|
|
1080
|
+
type: Optional[ObjectType] = None,
|
|
1081
|
+
allow_non_covered_slots: bool = False,
|
|
1082
|
+
) -> List[Union[ClusterScanCursor, List[bytes]]]:
|
|
1083
|
+
"""
|
|
1084
|
+
Incrementally iterates over the keys in the cluster.
|
|
1085
|
+
The method returns a list containing the next cursor and a list of keys.
|
|
1086
|
+
|
|
1087
|
+
This command is similar to the SCAN command but is designed to work in a cluster environment.
|
|
1088
|
+
For each iteration, the new cursor object should be used to continue the scan.
|
|
1089
|
+
Using the same cursor object for multiple iterations will result in the same keys or unexpected behavior.
|
|
1090
|
+
For more information about the Cluster Scan implementation, see [Cluster Scan](https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#cluster-scan).
|
|
1091
|
+
|
|
1092
|
+
Like the SCAN command, the method can be used to iterate over the keys in the database,
|
|
1093
|
+
returning all keys the database has from when the scan started until the scan ends.
|
|
1094
|
+
The same key can be returned in multiple scan iterations.
|
|
1095
|
+
|
|
1096
|
+
See https://valkey.io/commands/scan/ for more details.
|
|
1097
|
+
|
|
1098
|
+
Args:
|
|
1099
|
+
cursor (ClusterScanCursor): The cursor object that wraps the scan state.
|
|
1100
|
+
To start a new scan, create a new empty ClusterScanCursor using ClusterScanCursor().
|
|
1101
|
+
match (Optional[TEncodable]): A pattern to match keys against.
|
|
1102
|
+
count (Optional[int]): The number of keys to return in a single iteration.
|
|
1103
|
+
The actual number returned can vary and is not guaranteed to match this count exactly.
|
|
1104
|
+
This parameter serves as a hint to the server on the number of steps to perform in each iteration.
|
|
1105
|
+
The default value is 10.
|
|
1106
|
+
type (Optional[ObjectType]): The type of object to scan for.
|
|
1107
|
+
allow_non_covered_slots (bool): If set to True, the scan will perform even if some slots are not covered by any node.
|
|
1108
|
+
It's important to note that when set to True, the scan has no guarantee to cover all keys in the cluster,
|
|
1109
|
+
and the method loses its way to validate the progress of the scan. Defaults to False.
|
|
1110
|
+
|
|
1111
|
+
Returns:
|
|
1112
|
+
List[Union[ClusterScanCursor, List[TEncodable]]]: A list containing the next cursor and a list of keys,
|
|
1113
|
+
formatted as [ClusterScanCursor, [key1, key2, ...]].
|
|
1114
|
+
|
|
1115
|
+
Examples:
|
|
1116
|
+
>>> # Iterate over all keys in the cluster.
|
|
1117
|
+
>>> await client.mset({b'key1': b'value1', b'key2': b'value2', b'key3': b'value3'})
|
|
1118
|
+
>>> cursor = ClusterScanCursor()
|
|
1119
|
+
>>> all_keys = []
|
|
1120
|
+
>>> while not cursor.is_finished():
|
|
1121
|
+
>>> cursor, keys = await client.scan(cursor, count=10, allow_non_covered_slots=False)
|
|
1122
|
+
>>> all_keys.extend(keys)
|
|
1123
|
+
>>> print(all_keys) # [b'key1', b'key2', b'key3']
|
|
1124
|
+
|
|
1125
|
+
>>> # Iterate over keys matching the pattern "*key*".
|
|
1126
|
+
>>> await client.mset({b"key1": b"value1", b"key2": b"value2", b"not_my_key": b"value3", b"something_else": b"value4"})
|
|
1127
|
+
>>> cursor = ClusterScanCursor()
|
|
1128
|
+
>>> all_keys = []
|
|
1129
|
+
>>> while not cursor.is_finished():
|
|
1130
|
+
>>> cursor, keys = await client.scan(cursor, match=b"*key*", count=10, allow_non_covered_slots=False)
|
|
1131
|
+
>>> all_keys.extend(keys)
|
|
1132
|
+
>>> print(all_keys) # [b'key1', b'key2', b'not_my_key']
|
|
1133
|
+
|
|
1134
|
+
>>> # Iterate over keys of type STRING.
|
|
1135
|
+
>>> await client.mset({b'key1': b'value1', b'key2': b'value2', b'key3': b'value3'})
|
|
1136
|
+
>>> await client.sadd(b"this_is_a_set", [b"value4"])
|
|
1137
|
+
>>> cursor = ClusterScanCursor()
|
|
1138
|
+
>>> all_keys = []
|
|
1139
|
+
>>> while not cursor.is_finished():
|
|
1140
|
+
>>> cursor, keys = await client.scan(cursor, type=ObjectType.STRING, allow_non_covered_slots=False)
|
|
1141
|
+
>>> all_keys.extend(keys)
|
|
1142
|
+
>>> print(all_keys) # [b'key1', b'key2', b'key3']
|
|
1143
|
+
"""
|
|
1144
|
+
return cast(
|
|
1145
|
+
List[Union[ClusterScanCursor, List[bytes]]],
|
|
1146
|
+
await self._cluster_scan(
|
|
1147
|
+
cursor=cursor,
|
|
1148
|
+
match=match,
|
|
1149
|
+
count=count,
|
|
1150
|
+
type=type,
|
|
1151
|
+
allow_non_covered_slots=allow_non_covered_slots,
|
|
1152
|
+
),
|
|
1153
|
+
)
|
|
1154
|
+
|
|
1155
|
+
async def script_exists(
|
|
1156
|
+
self, sha1s: List[TEncodable], route: Optional[Route] = None
|
|
1157
|
+
) -> TClusterResponse[List[bool]]:
|
|
1158
|
+
"""
|
|
1159
|
+
Check existence of scripts in the script cache by their SHA1 digest.
|
|
1160
|
+
|
|
1161
|
+
See https://valkey.io/commands/script-exists for more details.
|
|
1162
|
+
|
|
1163
|
+
Args:
|
|
1164
|
+
sha1s (List[TEncodable]): List of SHA1 digests of the scripts to check.
|
|
1165
|
+
route (Optional[Route]): The command will be routed to all primary nodes, unless `route` is provided, in which
|
|
1166
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
1167
|
+
|
|
1168
|
+
Returns:
|
|
1169
|
+
TClusterResponse[List[bool]]: A list of boolean values indicating the existence of each script.
|
|
1170
|
+
|
|
1171
|
+
Examples:
|
|
1172
|
+
>>> lua_script = Script("return { KEYS[1], ARGV[1] }")
|
|
1173
|
+
>>> await client.script_exists([lua_script.get_hash(), "sha1_digest2"])
|
|
1174
|
+
[True, False]
|
|
1175
|
+
"""
|
|
1176
|
+
return cast(
|
|
1177
|
+
TClusterResponse[List[bool]],
|
|
1178
|
+
await self._execute_command(RequestType.ScriptExists, sha1s, route),
|
|
1179
|
+
)
|
|
1180
|
+
|
|
1181
|
+
async def script_flush(
|
|
1182
|
+
self, mode: Optional[FlushMode] = None, route: Optional[Route] = None
|
|
1183
|
+
) -> TOK:
|
|
1184
|
+
"""
|
|
1185
|
+
Flush the Lua scripts cache.
|
|
1186
|
+
|
|
1187
|
+
See https://valkey.io/commands/script-flush for more details.
|
|
1188
|
+
|
|
1189
|
+
Args:
|
|
1190
|
+
mode (Optional[FlushMode]): The flushing mode, could be either `SYNC` or `ASYNC`.
|
|
1191
|
+
route (Optional[Route]): The command will be routed automatically to all nodes, unless `route` is provided, in which
|
|
1192
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
1193
|
+
|
|
1194
|
+
Returns:
|
|
1195
|
+
TOK: A simple `OK` response.
|
|
1196
|
+
|
|
1197
|
+
Examples:
|
|
1198
|
+
>>> await client.script_flush()
|
|
1199
|
+
"OK"
|
|
1200
|
+
|
|
1201
|
+
>>> await client.script_flush(FlushMode.ASYNC)
|
|
1202
|
+
"OK"
|
|
1203
|
+
"""
|
|
1204
|
+
|
|
1205
|
+
return cast(
|
|
1206
|
+
TOK,
|
|
1207
|
+
await self._execute_command(
|
|
1208
|
+
RequestType.ScriptFlush, [mode.value] if mode else [], route
|
|
1209
|
+
),
|
|
1210
|
+
)
|
|
1211
|
+
|
|
1212
|
+
async def script_kill(self, route: Optional[Route] = None) -> TOK:
|
|
1213
|
+
"""
|
|
1214
|
+
Kill the currently executing Lua script, assuming no write operation was yet performed by the script.
|
|
1215
|
+
The command is routed to all nodes, and aggregates the response to a single array.
|
|
1216
|
+
|
|
1217
|
+
See https://valkey.io/commands/script-kill for more details.
|
|
1218
|
+
|
|
1219
|
+
Returns:
|
|
1220
|
+
TOK: A simple `OK` response.
|
|
1221
|
+
route (Optional[Route]): The command will be routed automatically to all nodes, unless `route` is provided, in which
|
|
1222
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
1223
|
+
|
|
1224
|
+
Examples:
|
|
1225
|
+
>>> await client.script_kill()
|
|
1226
|
+
"OK"
|
|
1227
|
+
"""
|
|
1228
|
+
return cast(TOK, await self._execute_command(RequestType.ScriptKill, [], route))
|
|
1229
|
+
|
|
1230
|
+
async def invoke_script(
|
|
1231
|
+
self,
|
|
1232
|
+
script: Script,
|
|
1233
|
+
keys: Optional[List[TEncodable]] = None,
|
|
1234
|
+
args: Optional[List[TEncodable]] = None,
|
|
1235
|
+
) -> TClusterResponse[TResult]:
|
|
1236
|
+
"""
|
|
1237
|
+
Invokes a Lua script with its keys and arguments.
|
|
1238
|
+
This method simplifies the process of invoking scripts on a server by using an object that represents a Lua script.
|
|
1239
|
+
The script loading, argument preparation, and execution will all be handled internally.
|
|
1240
|
+
If the script has not already been loaded, it will be loaded automatically using the `SCRIPT LOAD` command.
|
|
1241
|
+
After that, it will be invoked using the `EVALSHA` command.
|
|
1242
|
+
|
|
1243
|
+
When in cluster mode, `key`s must map to the same hash slot.
|
|
1244
|
+
|
|
1245
|
+
See https://valkey.io/commands/script-load/ and https://valkey.io/commands/evalsha/ for more details.
|
|
1246
|
+
|
|
1247
|
+
Args:
|
|
1248
|
+
script (Script): The Lua script to execute.
|
|
1249
|
+
keys (Optional[List[TEncodable]]): The keys that are used in the script. To ensure the correct execution of
|
|
1250
|
+
the script, all names of keys that a script accesses must be explicitly provided as `keys`.
|
|
1251
|
+
args (Optional[List[TEncodable]]): The non-key arguments for the script.
|
|
1252
|
+
|
|
1253
|
+
Returns:
|
|
1254
|
+
TResult: a value that depends on the script that was executed.
|
|
1255
|
+
|
|
1256
|
+
Examples:
|
|
1257
|
+
>>> lua_script = Script("return { KEYS[1], ARGV[1] }")
|
|
1258
|
+
>>> await client.invoke_script(lua_script, keys=["foo"], args=["bar"] );
|
|
1259
|
+
[b"foo", b"bar"]
|
|
1260
|
+
"""
|
|
1261
|
+
return await self._execute_script(script.get_hash(), keys, args)
|
|
1262
|
+
|
|
1263
|
+
async def invoke_script_route(
|
|
1264
|
+
self,
|
|
1265
|
+
script: Script,
|
|
1266
|
+
args: Optional[List[TEncodable]] = None,
|
|
1267
|
+
route: Optional[Route] = None,
|
|
1268
|
+
) -> TClusterResponse[TResult]:
|
|
1269
|
+
"""
|
|
1270
|
+
Invokes a Lua script with its arguments and route.
|
|
1271
|
+
This method simplifies the process of invoking scripts on a server by using an object that represents a Lua script.
|
|
1272
|
+
The script loading, argument preparation, and execution will all be handled internally.
|
|
1273
|
+
If the script has not already been loaded, it will be loaded automatically using the `SCRIPT LOAD` command.
|
|
1274
|
+
After that, it will be invoked using the `EVALSHA` command.
|
|
1275
|
+
|
|
1276
|
+
See https://valkey.io/commands/script-load/ and https://valkey.io/commands/evalsha/ for more details.
|
|
1277
|
+
|
|
1278
|
+
Args:
|
|
1279
|
+
script (Script): The Lua script to execute.
|
|
1280
|
+
args (Optional[List[TEncodable]]): The non-key arguments for the script.
|
|
1281
|
+
route (Optional[Route]): The command will be routed automatically to a random node, unless `route` is provided, in which
|
|
1282
|
+
case the client will route the command to the nodes defined by `route`. Defaults to None.
|
|
1283
|
+
|
|
1284
|
+
Returns:
|
|
1285
|
+
TResult: a value that depends on the script that was executed.
|
|
1286
|
+
|
|
1287
|
+
Examples:
|
|
1288
|
+
>>> lua_script = Script("return { ARGV[1] }")
|
|
1289
|
+
>>> await client.invoke_script(lua_script, args=["bar"], route=AllPrimaries());
|
|
1290
|
+
[b"bar"]
|
|
1291
|
+
"""
|
|
1292
|
+
return await self._execute_script(
|
|
1293
|
+
script.get_hash(), keys=None, args=args, route=route
|
|
1294
|
+
)
|