coredis 4.23.1__py3-none-any.whl → 5.0.0rc1__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.

Potentially problematic release.


This version of coredis might be problematic. Click here for more details.

Files changed (77) hide show
  1. coredis/__init__.py +1 -3
  2. coredis/_packer.py +10 -10
  3. coredis/_protocols.py +23 -32
  4. coredis/_py_311_typing.py +20 -0
  5. coredis/_py_312_typing.py +17 -0
  6. coredis/_utils.py +49 -51
  7. coredis/_version.py +3 -3
  8. coredis/cache.py +57 -82
  9. coredis/client/__init__.py +1 -2
  10. coredis/client/basic.py +129 -56
  11. coredis/client/cluster.py +147 -70
  12. coredis/commands/__init__.py +27 -7
  13. coredis/commands/_key_spec.py +11 -10
  14. coredis/commands/_utils.py +1 -1
  15. coredis/commands/_validators.py +30 -20
  16. coredis/commands/_wrappers.py +19 -99
  17. coredis/commands/bitfield.py +10 -2
  18. coredis/commands/constants.py +20 -3
  19. coredis/commands/core.py +1627 -1246
  20. coredis/commands/function.py +29 -22
  21. coredis/commands/monitor.py +0 -71
  22. coredis/commands/pubsub.py +7 -142
  23. coredis/commands/request.py +108 -0
  24. coredis/commands/script.py +9 -9
  25. coredis/commands/sentinel.py +60 -49
  26. coredis/connection.py +14 -15
  27. coredis/exceptions.py +2 -2
  28. coredis/experimental/__init__.py +0 -4
  29. coredis/globals.py +3 -0
  30. coredis/modules/autocomplete.py +28 -30
  31. coredis/modules/base.py +15 -31
  32. coredis/modules/filters.py +269 -245
  33. coredis/modules/graph.py +61 -62
  34. coredis/modules/json.py +172 -140
  35. coredis/modules/response/_callbacks/autocomplete.py +5 -4
  36. coredis/modules/response/_callbacks/graph.py +34 -29
  37. coredis/modules/response/_callbacks/json.py +5 -3
  38. coredis/modules/response/_callbacks/search.py +49 -53
  39. coredis/modules/response/_callbacks/timeseries.py +18 -30
  40. coredis/modules/response/types.py +1 -5
  41. coredis/modules/search.py +186 -169
  42. coredis/modules/timeseries.py +184 -164
  43. coredis/parser.py +6 -19
  44. coredis/pipeline.py +391 -422
  45. coredis/pool/basic.py +7 -7
  46. coredis/pool/cluster.py +3 -3
  47. coredis/pool/nodemanager.py +10 -3
  48. coredis/response/_callbacks/__init__.py +76 -57
  49. coredis/response/_callbacks/acl.py +0 -3
  50. coredis/response/_callbacks/cluster.py +25 -16
  51. coredis/response/_callbacks/command.py +8 -6
  52. coredis/response/_callbacks/connection.py +4 -3
  53. coredis/response/_callbacks/geo.py +17 -13
  54. coredis/response/_callbacks/hash.py +13 -11
  55. coredis/response/_callbacks/keys.py +9 -5
  56. coredis/response/_callbacks/module.py +2 -3
  57. coredis/response/_callbacks/script.py +6 -8
  58. coredis/response/_callbacks/sentinel.py +21 -17
  59. coredis/response/_callbacks/server.py +36 -14
  60. coredis/response/_callbacks/sets.py +3 -4
  61. coredis/response/_callbacks/sorted_set.py +27 -24
  62. coredis/response/_callbacks/streams.py +22 -13
  63. coredis/response/_callbacks/strings.py +7 -6
  64. coredis/response/_callbacks/vector_sets.py +126 -0
  65. coredis/response/types.py +13 -4
  66. coredis/sentinel.py +1 -1
  67. coredis/stream.py +4 -3
  68. coredis/tokens.py +343 -16
  69. coredis/typing.py +432 -79
  70. {coredis-4.23.1.dist-info → coredis-5.0.0rc1.dist-info}/METADATA +4 -5
  71. coredis-5.0.0rc1.dist-info/RECORD +95 -0
  72. coredis/client/keydb.py +0 -336
  73. coredis/pipeline.pyi +0 -2103
  74. coredis-4.23.1.dist-info/RECORD +0 -93
  75. {coredis-4.23.1.dist-info → coredis-5.0.0rc1.dist-info}/WHEEL +0 -0
  76. {coredis-4.23.1.dist-info → coredis-5.0.0rc1.dist-info}/licenses/LICENSE +0 -0
  77. {coredis-4.23.1.dist-info → coredis-5.0.0rc1.dist-info}/top_level.txt +0 -0
@@ -4,8 +4,8 @@ from deprecated.sphinx import versionadded
4
4
 
5
5
  from .._utils import dict_to_flat_list
6
6
  from ..commands._validators import mutually_inclusive_parameters
7
- from ..commands._wrappers import CacheConfig
8
7
  from ..commands.constants import CommandFlag, CommandGroup, CommandName
8
+ from ..commands.request import CommandRequest
9
9
  from ..response._callbacks import (
10
10
  BoolCallback,
11
11
  BoolsCallback,
@@ -53,14 +53,14 @@ class BloomFilter(ModuleGroup[AnyStr]):
53
53
  version_introduced="1.0.0",
54
54
  module=MODULE,
55
55
  )
56
- async def reserve(
56
+ def reserve(
57
57
  self,
58
58
  key: KeyT,
59
59
  error_rate: int | float,
60
60
  capacity: int,
61
61
  expansion: int | None = None,
62
62
  nonscaling: bool | None = None,
63
- ) -> bool:
63
+ ) -> CommandRequest[bool]:
64
64
  """
65
65
  Creates a new Bloom Filter
66
66
 
@@ -70,14 +70,14 @@ class BloomFilter(ModuleGroup[AnyStr]):
70
70
  :param expansion: The size of the new sub-filter when `capacity` is reached.
71
71
  :param nonscaling: Prevents the filter from creating additional sub-filters.
72
72
  """
73
- pieces: CommandArgList = [key, error_rate, capacity]
73
+ command_arguments: CommandArgList = [key, error_rate, capacity]
74
74
  if expansion is not None:
75
- pieces.extend([PrefixToken.EXPANSION, expansion])
75
+ command_arguments.extend([PrefixToken.EXPANSION, expansion])
76
76
  if nonscaling:
77
- pieces.append(PureToken.NONSCALING)
77
+ command_arguments.append(PureToken.NONSCALING)
78
78
 
79
- return await self.execute_module_command(
80
- CommandName.BF_RESERVE, *pieces, callback=SimpleStringCallback()
79
+ return self.client.create_request(
80
+ CommandName.BF_RESERVE, *command_arguments, callback=SimpleStringCallback()
81
81
  )
82
82
 
83
83
  @module_command(
@@ -86,17 +86,17 @@ class BloomFilter(ModuleGroup[AnyStr]):
86
86
  version_introduced="1.0.0",
87
87
  module=MODULE,
88
88
  )
89
- async def add(self, key: KeyT, item: ValueT) -> bool:
89
+ def add(self, key: KeyT, item: ValueT) -> CommandRequest[bool]:
90
90
  """
91
91
  Adds an item to a Bloom Filter
92
92
 
93
93
  :param key: The key under which the filter is found.
94
94
  :param item: The item to add to the filter.
95
95
  """
96
- pieces: CommandArgList = [key, item]
96
+ command_arguments: CommandArgList = [key, item]
97
97
 
98
- return await self.execute_module_command(
99
- CommandName.BF_ADD, *pieces, callback=BoolCallback()
98
+ return self.client.create_request(
99
+ CommandName.BF_ADD, *command_arguments, callback=BoolCallback()
100
100
  )
101
101
 
102
102
  @module_command(
@@ -105,17 +105,17 @@ class BloomFilter(ModuleGroup[AnyStr]):
105
105
  version_introduced="1.0.0",
106
106
  module=MODULE,
107
107
  )
108
- async def madd(self, key: KeyT, items: Parameters[ValueT]) -> tuple[bool, ...]:
108
+ def madd(self, key: KeyT, items: Parameters[ValueT]) -> CommandRequest[tuple[bool, ...]]:
109
109
  """
110
110
  Adds one or more items to a Bloom Filter. A filter will be created if it does not exist
111
111
 
112
112
  :param key: The key under which the filter is found.
113
113
  :param items: One or more items to add.
114
114
  """
115
- pieces: CommandArgList = [key, *items]
115
+ command_arguments: CommandArgList = [key, *items]
116
116
 
117
- return await self.execute_module_command(
118
- CommandName.BF_MADD, *pieces, callback=BoolsCallback()
117
+ return self.client.create_request(
118
+ CommandName.BF_MADD, *command_arguments, callback=BoolsCallback()
119
119
  )
120
120
 
121
121
  @module_command(
@@ -124,7 +124,7 @@ class BloomFilter(ModuleGroup[AnyStr]):
124
124
  version_introduced="1.0.0",
125
125
  module=MODULE,
126
126
  )
127
- async def insert(
127
+ def insert(
128
128
  self,
129
129
  key: KeyT,
130
130
  items: Parameters[ValueT],
@@ -133,7 +133,7 @@ class BloomFilter(ModuleGroup[AnyStr]):
133
133
  expansion: int | None = None,
134
134
  nocreate: bool | None = None,
135
135
  nonscaling: bool | None = None,
136
- ) -> tuple[bool, ...]:
136
+ ) -> CommandRequest[tuple[bool, ...]]:
137
137
  """
138
138
  Adds one or more items to a Bloom Filter. A filter will be created if it
139
139
  does not exist
@@ -148,21 +148,21 @@ class BloomFilter(ModuleGroup[AnyStr]):
148
148
  :param nonscaling: Prevents the filter from creating additional sub-filters
149
149
  if initial capacity is reached.
150
150
  """
151
- pieces: CommandArgList = [key]
151
+ command_arguments: CommandArgList = [key]
152
152
  if capacity is not None:
153
- pieces.extend([PrefixToken.CAPACITY, capacity])
153
+ command_arguments.extend([PrefixToken.CAPACITY, capacity])
154
154
  if error is not None:
155
- pieces.extend([PrefixToken.ERROR, error])
155
+ command_arguments.extend([PrefixToken.ERROR, error])
156
156
  if expansion is not None:
157
- pieces.extend([PrefixToken.EXPANSION, expansion])
157
+ command_arguments.extend([PrefixToken.EXPANSION, expansion])
158
158
  if nocreate:
159
- pieces.append(PureToken.NOCREATE)
159
+ command_arguments.append(PureToken.NOCREATE)
160
160
  if nonscaling:
161
- pieces.append(PureToken.NONSCALING)
162
- pieces.append(PureToken.ITEMS)
163
- pieces.extend(items)
164
- return await self.execute_module_command(
165
- CommandName.BF_INSERT, *pieces, callback=BoolsCallback()
161
+ command_arguments.append(PureToken.NONSCALING)
162
+ command_arguments.append(PureToken.ITEMS)
163
+ command_arguments.extend(items)
164
+ return self.client.create_request(
165
+ CommandName.BF_INSERT, *command_arguments, callback=BoolsCallback()
166
166
  )
167
167
 
168
168
  @module_command(
@@ -171,18 +171,16 @@ class BloomFilter(ModuleGroup[AnyStr]):
171
171
  version_introduced="1.0.0",
172
172
  module=MODULE,
173
173
  flags={CommandFlag.READONLY},
174
- cache_config=CacheConfig(lambda *a, **_: a[0]),
174
+ cacheable=True,
175
175
  )
176
- async def exists(self, key: KeyT, item: ValueT) -> bool:
176
+ def exists(self, key: KeyT, item: ValueT) -> CommandRequest[bool]:
177
177
  """
178
178
  Checks whether an item exists in a Bloom Filter
179
179
 
180
180
  :param key: The key under which the filter is found.
181
181
  :param item: The item to check for existence.
182
182
  """
183
- return await self.execute_module_command(
184
- CommandName.BF_EXISTS, key, item, callback=BoolCallback()
185
- )
183
+ return self.client.create_request(CommandName.BF_EXISTS, key, item, callback=BoolCallback())
186
184
 
187
185
  @module_command(
188
186
  CommandName.BF_MEXISTS,
@@ -190,16 +188,16 @@ class BloomFilter(ModuleGroup[AnyStr]):
190
188
  version_introduced="1.0.0",
191
189
  module=MODULE,
192
190
  flags={CommandFlag.READONLY},
193
- cache_config=CacheConfig(lambda *a, **_: a[0]),
191
+ cacheable=True,
194
192
  )
195
- async def mexists(self, key: KeyT, items: Parameters[ValueT]) -> tuple[bool, ...]:
193
+ def mexists(self, key: KeyT, items: Parameters[ValueT]) -> CommandRequest[tuple[bool, ...]]:
196
194
  """
197
195
  Checks whether one or more items exist in a Bloom Filter
198
196
 
199
197
  :param key: The key under which the filter is found.
200
198
  :param items: One or more items to check.
201
199
  """
202
- return await self.execute_module_command(
200
+ return self.client.create_request(
203
201
  CommandName.BF_MEXISTS, key, *items, callback=BoolsCallback()
204
202
  )
205
203
 
@@ -209,7 +207,7 @@ class BloomFilter(ModuleGroup[AnyStr]):
209
207
  version_introduced="1.0.0",
210
208
  module=MODULE,
211
209
  )
212
- async def scandump(self, key: KeyT, iterator: int) -> tuple[int, bytes | None]:
210
+ def scandump(self, key: KeyT, iterator: int) -> CommandRequest[tuple[int, bytes | None]]:
213
211
  """
214
212
  Begins an incremental save of the bloom filter
215
213
 
@@ -222,12 +220,12 @@ class BloomFilter(ModuleGroup[AnyStr]):
222
220
  restoring the filter.
223
221
  """
224
222
 
225
- return await self.execute_module_command(
223
+ return self.client.create_request(
226
224
  CommandName.BF_SCANDUMP,
227
225
  key,
228
226
  iterator,
229
227
  callback=MixedTupleCallback[int, bytes | None](),
230
- decode=False,
228
+ execution_parameters={"decode": False},
231
229
  )
232
230
 
233
231
  @module_command(
@@ -236,7 +234,7 @@ class BloomFilter(ModuleGroup[AnyStr]):
236
234
  version_introduced="1.0.0",
237
235
  module=MODULE,
238
236
  )
239
- async def loadchunk(self, key: KeyT, iterator: int, data: bytes) -> bool:
237
+ def loadchunk(self, key: KeyT, iterator: int, data: bytes) -> CommandRequest[bool]:
240
238
  """
241
239
  Restores a filter previously saved using :meth:`scandump`
242
240
 
@@ -244,10 +242,12 @@ class BloomFilter(ModuleGroup[AnyStr]):
244
242
  :param iterator: Iterator value associated with the data chunk.
245
243
  :param data: Current data chunk.
246
244
  """
247
- pieces: CommandArgList = [key, iterator, data]
245
+ command_arguments: CommandArgList = [key, iterator, data]
248
246
 
249
- return await self.execute_module_command(
250
- CommandName.BF_LOADCHUNK, *pieces, callback=SimpleStringCallback()
247
+ return self.client.create_request(
248
+ CommandName.BF_LOADCHUNK,
249
+ *command_arguments,
250
+ callback=SimpleStringCallback(),
251
251
  )
252
252
 
253
253
  @module_command(
@@ -256,9 +256,9 @@ class BloomFilter(ModuleGroup[AnyStr]):
256
256
  version_introduced="1.0.0",
257
257
  module=MODULE,
258
258
  flags={CommandFlag.READONLY},
259
- cache_config=CacheConfig(lambda *a, **_: a[0]),
259
+ cacheable=True,
260
260
  )
261
- async def info(
261
+ def info(
262
262
  self,
263
263
  key: KeyT,
264
264
  single_value: None
@@ -271,7 +271,7 @@ class BloomFilter(ModuleGroup[AnyStr]):
271
271
  PureToken.SIZE,
272
272
  ]
273
273
  ) = None,
274
- ) -> dict[AnyStr, int] | int:
274
+ ) -> CommandRequest[int] | CommandRequest[dict[AnyStr, int]]:
275
275
  """
276
276
  Returns information about a Bloom Filter
277
277
 
@@ -282,14 +282,14 @@ class BloomFilter(ModuleGroup[AnyStr]):
282
282
  is not specified, or an integer representing the value of the specified field.
283
283
  """
284
284
  if single_value:
285
- return await self.execute_module_command(
285
+ return self.client.create_request(
286
286
  CommandName.BF_INFO,
287
287
  key,
288
288
  single_value,
289
289
  callback=FirstValueCallback[int](),
290
290
  )
291
291
  else:
292
- return await self.execute_module_command(
292
+ return self.client.create_request(
293
293
  CommandName.BF_INFO, key, callback=DictCallback[AnyStr, int]()
294
294
  )
295
295
 
@@ -299,15 +299,15 @@ class BloomFilter(ModuleGroup[AnyStr]):
299
299
  version_introduced="2.4.4",
300
300
  module=MODULE,
301
301
  flags={CommandFlag.READONLY},
302
- cache_config=CacheConfig(lambda *a, **_: a[0]),
302
+ cacheable=True,
303
303
  )
304
- async def card(self, key: KeyT) -> int:
304
+ def card(self, key: KeyT) -> CommandRequest[int]:
305
305
  """
306
306
  Returns the cardinality of a Bloom filter
307
307
 
308
308
  :param key: The key name for an existing Bloom filter.
309
309
  """
310
- return await self.execute_module_command(CommandName.BF_CARD, key, callback=IntCallback())
310
+ return self.client.create_request(CommandName.BF_CARD, key, callback=IntCallback())
311
311
 
312
312
 
313
313
  @versionadded(version="4.12")
@@ -321,14 +321,14 @@ class CuckooFilter(ModuleGroup[AnyStr]):
321
321
  version_introduced="1.0.0",
322
322
  module=MODULE,
323
323
  )
324
- async def reserve(
324
+ def reserve(
325
325
  self,
326
326
  key: KeyT,
327
327
  capacity: int,
328
328
  bucketsize: int | None = None,
329
329
  maxiterations: int | None = None,
330
330
  expansion: int | None = None,
331
- ) -> bool:
331
+ ) -> CommandRequest[bool]:
332
332
  """
333
333
  Creates a new Cuckoo Filter
334
334
 
@@ -340,15 +340,15 @@ class CuckooFilter(ModuleGroup[AnyStr]):
340
340
  :param expansion: When a new filter is created, its size is the size of the
341
341
  current filter multiplied by ``expansion``.
342
342
  """
343
- pieces: CommandArgList = [key, capacity]
343
+ command_arguments: CommandArgList = [key, capacity]
344
344
  if bucketsize is not None:
345
- pieces.extend([PrefixToken.BUCKETSIZE, bucketsize])
345
+ command_arguments.extend([PrefixToken.BUCKETSIZE, bucketsize])
346
346
  if maxiterations is not None:
347
- pieces.extend([PrefixToken.MAXITERATIONS, maxiterations])
347
+ command_arguments.extend([PrefixToken.MAXITERATIONS, maxiterations])
348
348
  if expansion is not None:
349
- pieces.extend([PrefixToken.EXPANSION, expansion])
350
- return await self.execute_module_command(
351
- CommandName.CF_RESERVE, *pieces, callback=SimpleStringCallback()
349
+ command_arguments.extend([PrefixToken.EXPANSION, expansion])
350
+ return self.client.create_request(
351
+ CommandName.CF_RESERVE, *command_arguments, callback=SimpleStringCallback()
352
352
  )
353
353
 
354
354
  @module_command(
@@ -357,17 +357,17 @@ class CuckooFilter(ModuleGroup[AnyStr]):
357
357
  version_introduced="1.0.0",
358
358
  module=MODULE,
359
359
  )
360
- async def add(self, key: KeyT, item: ValueT) -> bool:
360
+ def add(self, key: KeyT, item: ValueT) -> CommandRequest[bool]:
361
361
  """
362
362
  Adds an item to a Cuckoo Filter
363
363
 
364
364
  :param key: The name of the filter.
365
365
  :param item: The item to add.
366
366
  """
367
- pieces: CommandArgList = [key, item]
367
+ command_arguments: CommandArgList = [key, item]
368
368
 
369
- return await self.execute_module_command(
370
- CommandName.CF_ADD, *pieces, callback=BoolCallback()
369
+ return self.client.create_request(
370
+ CommandName.CF_ADD, *command_arguments, callback=BoolCallback()
371
371
  )
372
372
 
373
373
  @module_command(
@@ -376,17 +376,17 @@ class CuckooFilter(ModuleGroup[AnyStr]):
376
376
  version_introduced="1.0.0",
377
377
  module=MODULE,
378
378
  )
379
- async def addnx(self, key: KeyT, item: ValueT) -> bool:
379
+ def addnx(self, key: KeyT, item: ValueT) -> CommandRequest[bool]:
380
380
  """
381
381
  Adds an item to a Cuckoo Filter if the item did not exist previously.
382
382
 
383
383
  :param key: The name of the filter.
384
384
  :param item: The item to add.
385
385
  """
386
- pieces: CommandArgList = [key, item]
386
+ command_arguments: CommandArgList = [key, item]
387
387
 
388
- return await self.execute_module_command(
389
- CommandName.CF_ADDNX, *pieces, callback=BoolCallback()
388
+ return self.client.create_request(
389
+ CommandName.CF_ADDNX, *command_arguments, callback=BoolCallback()
390
390
  )
391
391
 
392
392
  @module_command(
@@ -395,13 +395,13 @@ class CuckooFilter(ModuleGroup[AnyStr]):
395
395
  version_introduced="1.0.0",
396
396
  module=MODULE,
397
397
  )
398
- async def insert(
398
+ def insert(
399
399
  self,
400
400
  key: KeyT,
401
401
  items: Parameters[ValueT],
402
402
  capacity: int | None = None,
403
403
  nocreate: bool | None = None,
404
- ) -> tuple[bool, ...]:
404
+ ) -> CommandRequest[tuple[bool, ...]]:
405
405
  """
406
406
  Adds one or more items to a Cuckoo Filter. A filter will be created if it does not exist
407
407
 
@@ -413,16 +413,16 @@ class CuckooFilter(ModuleGroup[AnyStr]):
413
413
  does not exist.
414
414
  :return: A tuple of boolean values indicating if the command was executed correctly.
415
415
  """
416
- pieces: CommandArgList = [key]
416
+ command_arguments: CommandArgList = [key]
417
417
  if capacity is not None:
418
- pieces.extend([PrefixToken.CAPACITY, capacity])
418
+ command_arguments.extend([PrefixToken.CAPACITY, capacity])
419
419
  if nocreate is not None:
420
- pieces.append(PureToken.NOCREATE)
421
- pieces.append(PureToken.ITEMS)
422
- pieces.extend(items)
420
+ command_arguments.append(PureToken.NOCREATE)
421
+ command_arguments.append(PureToken.ITEMS)
422
+ command_arguments.extend(items)
423
423
 
424
- return await self.execute_module_command(
425
- CommandName.CF_INSERT, *pieces, callback=BoolsCallback()
424
+ return self.client.create_request(
425
+ CommandName.CF_INSERT, *command_arguments, callback=BoolsCallback()
426
426
  )
427
427
 
428
428
  @module_command(
@@ -431,13 +431,13 @@ class CuckooFilter(ModuleGroup[AnyStr]):
431
431
  version_introduced="1.0.0",
432
432
  module=MODULE,
433
433
  )
434
- async def insertnx(
434
+ def insertnx(
435
435
  self,
436
436
  key: KeyT,
437
437
  items: Parameters[ValueT],
438
438
  capacity: int | None = None,
439
439
  nocreate: bool | None = None,
440
- ) -> tuple[bool, ...]:
440
+ ) -> CommandRequest[tuple[bool, ...]]:
441
441
  """
442
442
  Adds one or more items to a Cuckoo Filter if the items did not exist previously.
443
443
  A filter will be created if it does not exist
@@ -449,16 +449,16 @@ class CuckooFilter(ModuleGroup[AnyStr]):
449
449
  :param nocreate: If specified, prevents automatic filter creation
450
450
  if the filter does not exist.
451
451
  """
452
- pieces: CommandArgList = [key]
452
+ command_arguments: CommandArgList = [key]
453
453
  if capacity is not None:
454
- pieces.extend([PrefixToken.CAPACITY, capacity])
454
+ command_arguments.extend([PrefixToken.CAPACITY, capacity])
455
455
  if nocreate is not None:
456
- pieces.append(PureToken.NOCREATE)
457
- pieces.append(PureToken.ITEMS)
458
- pieces.extend(items)
456
+ command_arguments.append(PureToken.NOCREATE)
457
+ command_arguments.append(PureToken.ITEMS)
458
+ command_arguments.extend(items)
459
459
 
460
- return await self.execute_module_command(
461
- CommandName.CF_INSERTNX, *pieces, callback=BoolsCallback()
460
+ return self.client.create_request(
461
+ CommandName.CF_INSERTNX, *command_arguments, callback=BoolsCallback()
462
462
  )
463
463
 
464
464
  @module_command(
@@ -467,19 +467,19 @@ class CuckooFilter(ModuleGroup[AnyStr]):
467
467
  version_introduced="1.0.0",
468
468
  module=MODULE,
469
469
  flags={CommandFlag.READONLY},
470
- cache_config=CacheConfig(lambda *a, **_: a[0]),
470
+ cacheable=True,
471
471
  )
472
- async def exists(self, key: KeyT, item: ValueT) -> bool:
472
+ def exists(self, key: KeyT, item: ValueT) -> CommandRequest[bool]:
473
473
  """
474
474
  Checks whether an item exist in a Cuckoo Filter
475
475
 
476
476
  :param key: The name of the filter.
477
477
  :param item: The item to check for.
478
478
  """
479
- pieces: CommandArgList = [key, item]
479
+ command_arguments: CommandArgList = [key, item]
480
480
 
481
- return await self.execute_module_command(
482
- CommandName.CF_EXISTS, *pieces, callback=BoolCallback()
481
+ return self.client.create_request(
482
+ CommandName.CF_EXISTS, *command_arguments, callback=BoolCallback()
483
483
  )
484
484
 
485
485
  @module_command(
@@ -488,19 +488,19 @@ class CuckooFilter(ModuleGroup[AnyStr]):
488
488
  version_introduced="1.0.0",
489
489
  module=MODULE,
490
490
  flags={CommandFlag.READONLY},
491
- cache_config=CacheConfig(lambda *a, **_: a[0]),
491
+ cacheable=True,
492
492
  )
493
- async def mexists(self, key: KeyT, items: Parameters[ValueT]) -> tuple[bool, ...]:
493
+ def mexists(self, key: KeyT, items: Parameters[ValueT]) -> CommandRequest[tuple[bool, ...]]:
494
494
  """
495
495
  Checks whether one or more items exist in a Cuckoo Filter
496
496
 
497
497
  :param key: The name of the filter.
498
498
  :param items: The item(s) to check for.
499
499
  """
500
- pieces: CommandArgList = [key, *items]
500
+ command_arguments: CommandArgList = [key, *items]
501
501
 
502
- return await self.execute_module_command(
503
- CommandName.CF_MEXISTS, *pieces, callback=BoolsCallback()
502
+ return self.client.create_request(
503
+ CommandName.CF_MEXISTS, *command_arguments, callback=BoolsCallback()
504
504
  )
505
505
 
506
506
  @module_command(
@@ -509,17 +509,17 @@ class CuckooFilter(ModuleGroup[AnyStr]):
509
509
  version_introduced="1.0.0",
510
510
  module=MODULE,
511
511
  )
512
- async def delete(self, key: KeyT, item: ValueT) -> bool:
512
+ def delete(self, key: KeyT, item: ValueT) -> CommandRequest[bool]:
513
513
  """
514
514
  Deletes an item from a Cuckoo Filter
515
515
 
516
516
  :param key: The name of the filter.
517
517
  :param item: The item to delete from the filter.
518
518
  """
519
- pieces: CommandArgList = [key, item]
519
+ command_arguments: CommandArgList = [key, item]
520
520
 
521
- return await self.execute_module_command(
522
- CommandName.CF_DEL, *pieces, callback=BoolCallback()
521
+ return self.client.create_request(
522
+ CommandName.CF_DEL, *command_arguments, callback=BoolCallback()
523
523
  )
524
524
 
525
525
  @module_command(
@@ -528,19 +528,19 @@ class CuckooFilter(ModuleGroup[AnyStr]):
528
528
  version_introduced="1.0.0",
529
529
  module=MODULE,
530
530
  flags={CommandFlag.READONLY},
531
- cache_config=CacheConfig(lambda *a, **_: a[0]),
531
+ cacheable=True,
532
532
  )
533
- async def count(self, key: KeyT, item: ValueT) -> int:
533
+ def count(self, key: KeyT, item: ValueT) -> CommandRequest[int]:
534
534
  """
535
535
  Return the number of times an item might be in a Cuckoo Filter
536
536
 
537
537
  :param key: The name of the filter.
538
538
  :param item: The item to count.
539
539
  """
540
- pieces: CommandArgList = [key, item]
540
+ command_arguments: CommandArgList = [key, item]
541
541
 
542
- return await self.execute_module_command(
543
- CommandName.CF_COUNT, *pieces, callback=IntCallback()
542
+ return self.client.create_request(
543
+ CommandName.CF_COUNT, *command_arguments, callback=IntCallback()
544
544
  )
545
545
 
546
546
  @module_command(
@@ -549,7 +549,7 @@ class CuckooFilter(ModuleGroup[AnyStr]):
549
549
  version_introduced="1.0.0",
550
550
  module=MODULE,
551
551
  )
552
- async def scandump(self, key: KeyT, iterator: int) -> tuple[int, bytes | None]:
552
+ def scandump(self, key: KeyT, iterator: int) -> CommandRequest[tuple[int, bytes | None]]:
553
553
  """
554
554
  Begins an incremental save of the bloom filter
555
555
 
@@ -557,12 +557,12 @@ class CuckooFilter(ModuleGroup[AnyStr]):
557
557
  :param iterator: Iterator value. This is either 0, or the iterator from a
558
558
  previous invocation of this command.
559
559
  """
560
- pieces: CommandArgList = [key, iterator]
560
+ command_arguments: CommandArgList = [key, iterator]
561
561
 
562
- return await self.execute_module_command(
562
+ return self.client.create_request(
563
563
  CommandName.CF_SCANDUMP,
564
- *pieces,
565
- decode=False,
564
+ *command_arguments,
565
+ execution_parameters={"decode": False},
566
566
  callback=MixedTupleCallback[int, bytes | None](),
567
567
  )
568
568
 
@@ -572,7 +572,7 @@ class CuckooFilter(ModuleGroup[AnyStr]):
572
572
  version_introduced="1.0.0",
573
573
  module=MODULE,
574
574
  )
575
- async def loadchunk(self, key: KeyT, iterator: int, data: StringT) -> bool:
575
+ def loadchunk(self, key: KeyT, iterator: int, data: StringT) -> CommandRequest[bool]:
576
576
  """
577
577
  Restores a filter previously saved using SCANDUMP
578
578
 
@@ -581,10 +581,12 @@ class CuckooFilter(ModuleGroup[AnyStr]):
581
581
  :param data: Current data chunk (returned by :meth:`scandump`).
582
582
 
583
583
  """
584
- pieces: CommandArgList = [key, iterator, data]
584
+ command_arguments: CommandArgList = [key, iterator, data]
585
585
 
586
- return await self.execute_module_command(
587
- CommandName.CF_LOADCHUNK, *pieces, callback=SimpleStringCallback()
586
+ return self.client.create_request(
587
+ CommandName.CF_LOADCHUNK,
588
+ *command_arguments,
589
+ callback=SimpleStringCallback(),
588
590
  )
589
591
 
590
592
  @module_command(
@@ -594,15 +596,17 @@ class CuckooFilter(ModuleGroup[AnyStr]):
594
596
  module=MODULE,
595
597
  flags={CommandFlag.READONLY},
596
598
  )
597
- async def info(self, key: KeyT) -> dict[AnyStr, ResponsePrimitive]:
599
+ def info(self, key: KeyT) -> CommandRequest[dict[AnyStr, ResponsePrimitive]]:
598
600
  """
599
601
  Returns information about a Cuckoo Filter
600
602
 
601
603
  :param key: The name of the filter.
602
604
  """
603
605
 
604
- return await self.execute_module_command(
605
- CommandName.CF_INFO, key, callback=DictCallback[AnyStr, ResponsePrimitive]()
606
+ return self.client.create_request(
607
+ CommandName.CF_INFO,
608
+ key,
609
+ callback=DictCallback[AnyStr, ResponsePrimitive](),
606
610
  )
607
611
 
608
612
 
@@ -617,7 +621,7 @@ class CountMinSketch(ModuleGroup[AnyStr]):
617
621
  version_introduced="2.0.0",
618
622
  module=MODULE,
619
623
  )
620
- async def initbydim(self, key: KeyT, width: int, depth: int) -> bool:
624
+ def initbydim(self, key: KeyT, width: int, depth: int) -> CommandRequest[bool]:
621
625
  """
622
626
  Initializes a Count-Min Sketch to dimensions specified by user
623
627
 
@@ -625,7 +629,7 @@ class CountMinSketch(ModuleGroup[AnyStr]):
625
629
  :param width: Number of counters in each array. Reduces error size.
626
630
  :param depth: Number of counter-arrays. Reduces error probability.
627
631
  """
628
- return await self.execute_module_command(
632
+ return self.client.create_request(
629
633
  CommandName.CMS_INITBYDIM,
630
634
  key,
631
635
  width,
@@ -639,7 +643,9 @@ class CountMinSketch(ModuleGroup[AnyStr]):
639
643
  version_introduced="2.0.0",
640
644
  module=MODULE,
641
645
  )
642
- async def initbyprob(self, key: KeyT, error: int | float, probability: int | float) -> bool:
646
+ def initbyprob(
647
+ self, key: KeyT, error: int | float, probability: int | float
648
+ ) -> CommandRequest[bool]:
643
649
  """
644
650
  Initializes a Count-Min Sketch to accommodate requested tolerances.
645
651
 
@@ -648,7 +654,7 @@ class CountMinSketch(ModuleGroup[AnyStr]):
648
654
  :param probability: Desired probability for inflated count as a decimal value
649
655
  between 0 and 1.
650
656
  """
651
- return await self.execute_module_command(
657
+ return self.client.create_request(
652
658
  CommandName.CMS_INITBYPROB,
653
659
  key,
654
660
  error,
@@ -662,7 +668,7 @@ class CountMinSketch(ModuleGroup[AnyStr]):
662
668
  version_introduced="2.0.0",
663
669
  module=MODULE,
664
670
  )
665
- async def incrby(self, key: KeyT, items: Mapping[AnyStr, int]) -> tuple[int, ...]:
671
+ def incrby(self, key: KeyT, items: Mapping[AnyStr, int]) -> CommandRequest[tuple[int, ...]]:
666
672
  """
667
673
  Increases the count of one or more items by increment
668
674
 
@@ -671,7 +677,7 @@ class CountMinSketch(ModuleGroup[AnyStr]):
671
677
  their respective increments.
672
678
  """
673
679
 
674
- return await self.execute_module_command(
680
+ return self.client.create_request(
675
681
  CommandName.CMS_INCRBY,
676
682
  key,
677
683
  *dict_to_flat_list(items),
@@ -684,23 +690,23 @@ class CountMinSketch(ModuleGroup[AnyStr]):
684
690
  version_introduced="2.0.0",
685
691
  module=MODULE,
686
692
  flags={CommandFlag.READONLY},
687
- cache_config=CacheConfig(lambda *a, **_: a[0]),
693
+ cacheable=True,
688
694
  )
689
- async def query(
695
+ def query(
690
696
  self,
691
697
  key: KeyT,
692
698
  items: Parameters[StringT],
693
- ) -> tuple[int, ...]:
699
+ ) -> CommandRequest[tuple[int, ...]]:
694
700
  """
695
701
  Returns the count for one or more items in a sketch
696
702
 
697
703
  :param key: The name of the Count-Min Sketch.
698
704
  :param items: One or more items for which to return the count.
699
705
  """
700
- pieces: CommandArgList = [key, *items]
706
+ command_arguments: CommandArgList = [key, *items]
701
707
 
702
- return await self.execute_module_command(
703
- CommandName.CMS_QUERY, *pieces, callback=TupleCallback[int]()
708
+ return self.client.create_request(
709
+ CommandName.CMS_QUERY, *command_arguments, callback=TupleCallback[int]()
704
710
  )
705
711
 
706
712
  @module_command(
@@ -709,12 +715,12 @@ class CountMinSketch(ModuleGroup[AnyStr]):
709
715
  version_introduced="2.0.0",
710
716
  module=MODULE,
711
717
  )
712
- async def merge(
718
+ def merge(
713
719
  self,
714
720
  destination: KeyT,
715
721
  sources: Parameters[KeyT],
716
722
  weights: Parameters[int | float] | None = None,
717
- ) -> bool:
723
+ ) -> CommandRequest[bool]:
718
724
  """
719
725
  Merges several sketches into one sketch
720
726
 
@@ -723,13 +729,13 @@ class CountMinSketch(ModuleGroup[AnyStr]):
723
729
  :param weights: Multiples of each sketch. Default is 1.
724
730
  """
725
731
  _sources: list[KeyT] = list(sources)
726
- pieces: CommandArgList = [destination, len(_sources), *_sources]
732
+ command_arguments: CommandArgList = [destination, len(_sources), *_sources]
727
733
  if weights:
728
- pieces.append(PrefixToken.WEIGHTS)
729
- pieces.extend(weights)
734
+ command_arguments.append(PrefixToken.WEIGHTS)
735
+ command_arguments.extend(weights)
730
736
 
731
- return await self.execute_module_command(
732
- CommandName.CMS_MERGE, *pieces, callback=SimpleStringCallback()
737
+ return self.client.create_request(
738
+ CommandName.CMS_MERGE, *command_arguments, callback=SimpleStringCallback()
733
739
  )
734
740
 
735
741
  @module_command(
@@ -738,9 +744,9 @@ class CountMinSketch(ModuleGroup[AnyStr]):
738
744
  version_introduced="2.0.0",
739
745
  module=MODULE,
740
746
  flags={CommandFlag.READONLY},
741
- cache_config=CacheConfig(lambda *a, **_: a[0]),
747
+ cacheable=True,
742
748
  )
743
- async def info(self, key: KeyT) -> dict[AnyStr, int]:
749
+ def info(self, key: KeyT) -> CommandRequest[dict[AnyStr, int]]:
744
750
  """
745
751
  Returns information about a sketch
746
752
 
@@ -748,7 +754,7 @@ class CountMinSketch(ModuleGroup[AnyStr]):
748
754
  :return: A dictionary containing the width, depth, and total count of the sketch.
749
755
  """
750
756
 
751
- return await self.execute_module_command(
757
+ return self.client.create_request(
752
758
  CommandName.CMS_INFO,
753
759
  key,
754
760
  callback=DictCallback[AnyStr, int](),
@@ -767,14 +773,14 @@ class TopK(ModuleGroup[AnyStr]):
767
773
  version_introduced="2.0.0",
768
774
  module=MODULE,
769
775
  )
770
- async def reserve(
776
+ def reserve(
771
777
  self,
772
778
  key: KeyT,
773
779
  topk: int,
774
780
  width: int | None = None,
775
781
  depth: int | None = None,
776
782
  decay: int | float | None = None,
777
- ) -> bool:
783
+ ) -> CommandRequest[bool]:
778
784
  """
779
785
  Reserve a TopK sketch with specified parameters.
780
786
 
@@ -786,11 +792,13 @@ class TopK(ModuleGroup[AnyStr]):
786
792
  It is raised to power of it's counter (``decay ^ bucket[i].counter``).
787
793
  Therefore, as the counter gets higher, the chance of a reduction is being reduced.
788
794
  """
789
- pieces: CommandArgList = [key, topk]
795
+ command_arguments: CommandArgList = [key, topk]
790
796
  if width is not None and depth is not None and decay is not None:
791
- pieces.extend([width, depth, decay])
792
- return await self.execute_module_command(
793
- CommandName.TOPK_RESERVE, *pieces, callback=SimpleStringCallback()
797
+ command_arguments.extend([width, depth, decay])
798
+ return self.client.create_request(
799
+ CommandName.TOPK_RESERVE,
800
+ *command_arguments,
801
+ callback=SimpleStringCallback(),
794
802
  )
795
803
 
796
804
  @module_command(
@@ -799,7 +807,9 @@ class TopK(ModuleGroup[AnyStr]):
799
807
  version_introduced="2.0.0",
800
808
  module=MODULE,
801
809
  )
802
- async def add(self, key: KeyT, items: Parameters[AnyStr]) -> tuple[AnyStr | None, ...]:
810
+ def add(
811
+ self, key: KeyT, items: Parameters[AnyStr]
812
+ ) -> CommandRequest[tuple[AnyStr | None, ...]]:
803
813
  """
804
814
  Increases the count of one or more items by increment
805
815
 
@@ -807,7 +817,7 @@ class TopK(ModuleGroup[AnyStr]):
807
817
  :param items: Item(s) to be added.
808
818
 
809
819
  """
810
- return await self.execute_module_command(
820
+ return self.client.create_request(
811
821
  CommandName.TOPK_ADD,
812
822
  key,
813
823
  *items,
@@ -820,14 +830,16 @@ class TopK(ModuleGroup[AnyStr]):
820
830
  version_introduced="2.0.0",
821
831
  module=MODULE,
822
832
  )
823
- async def incrby(self, key: KeyT, items: Mapping[AnyStr, int]) -> tuple[AnyStr | None, ...]:
833
+ def incrby(
834
+ self, key: KeyT, items: Mapping[AnyStr, int]
835
+ ) -> CommandRequest[tuple[AnyStr | None, ...]]:
824
836
  """
825
837
  Increases the count of one or more items by increment
826
838
 
827
839
  :param key: Name of the TOP-K sketch.
828
840
  :param items: Dictionary of items and their corresponding increment values.
829
841
  """
830
- return await self.execute_module_command(
842
+ return self.client.create_request(
831
843
  CommandName.TOPK_INCRBY,
832
844
  key,
833
845
  *dict_to_flat_list(items),
@@ -840,13 +852,13 @@ class TopK(ModuleGroup[AnyStr]):
840
852
  version_introduced="2.0.0",
841
853
  module=MODULE,
842
854
  flags={CommandFlag.READONLY},
843
- cache_config=CacheConfig(lambda *a, **_: a[0]),
855
+ cacheable=True,
844
856
  )
845
- async def query(
857
+ def query(
846
858
  self,
847
859
  key: KeyT,
848
860
  items: Parameters[StringT],
849
- ) -> tuple[bool, ...]:
861
+ ) -> CommandRequest[tuple[bool, ...]]:
850
862
  """
851
863
  Checks whether an item is one of Top-K items.
852
864
  Multiple items can be checked at once.
@@ -854,10 +866,10 @@ class TopK(ModuleGroup[AnyStr]):
854
866
  :param key: Name of the TOP-K sketch.
855
867
  :param items: Item(s) to be queried.
856
868
  """
857
- pieces: CommandArgList = [key, *items]
869
+ command_arguments: CommandArgList = [key, *items]
858
870
 
859
- return await self.execute_module_command(
860
- CommandName.TOPK_QUERY, *pieces, callback=BoolsCallback()
871
+ return self.client.create_request(
872
+ CommandName.TOPK_QUERY, *command_arguments, callback=BoolsCallback()
861
873
  )
862
874
 
863
875
  @module_command(
@@ -866,21 +878,21 @@ class TopK(ModuleGroup[AnyStr]):
866
878
  version_introduced="2.0.0",
867
879
  module=MODULE,
868
880
  )
869
- async def count(
881
+ def count(
870
882
  self,
871
883
  key: KeyT,
872
884
  items: Parameters[StringT],
873
- ) -> tuple[int, ...]:
885
+ ) -> CommandRequest[tuple[int, ...]]:
874
886
  """
875
887
  Return the count for one or more items are in a sketch
876
888
 
877
889
  :param key: The name of the TOP-K sketch.
878
890
  :param items: One or more items to count.
879
891
  """
880
- pieces: CommandArgList = [key, *items]
892
+ command_arguments: CommandArgList = [key, *items]
881
893
 
882
- return await self.execute_module_command(
883
- CommandName.TOPK_COUNT, *pieces, callback=TupleCallback[int]()
894
+ return self.client.create_request(
895
+ CommandName.TOPK_COUNT, *command_arguments, callback=TupleCallback[int]()
884
896
  )
885
897
 
886
898
  @module_command(
@@ -889,26 +901,30 @@ class TopK(ModuleGroup[AnyStr]):
889
901
  version_introduced="2.0.0",
890
902
  module=MODULE,
891
903
  flags={CommandFlag.READONLY},
892
- cache_config=CacheConfig(lambda *a, **_: a[0]),
904
+ cacheable=True,
893
905
  )
894
- async def list(
906
+ def list(
895
907
  self, key: KeyT, withcount: bool | None = None
896
- ) -> dict[AnyStr, int] | tuple[AnyStr, ...]:
908
+ ) -> CommandRequest[dict[AnyStr, int]] | CommandRequest[tuple[AnyStr, ...]]:
897
909
  """
898
910
  Return full list of items in Top K list
899
911
 
900
912
  :param key: Name of the TOP-K sketch.
901
913
  :param withcount: Whether to include counts of each element.
902
914
  """
903
- pieces: CommandArgList = [key]
915
+ command_arguments: CommandArgList = [key]
904
916
  if withcount:
905
- pieces.append(PureToken.WITHCOUNT)
906
- return await self.execute_module_command(
907
- CommandName.TOPK_LIST, *pieces, callback=DictCallback[AnyStr, int]()
917
+ command_arguments.append(PureToken.WITHCOUNT)
918
+ return self.client.create_request(
919
+ CommandName.TOPK_LIST,
920
+ *command_arguments,
921
+ callback=DictCallback[AnyStr, int](),
908
922
  )
909
923
  else:
910
- return await self.execute_module_command(
911
- CommandName.TOPK_LIST, *pieces, callback=TupleCallback[AnyStr]()
924
+ return self.client.create_request(
925
+ CommandName.TOPK_LIST,
926
+ *command_arguments,
927
+ callback=TupleCallback[AnyStr](),
912
928
  )
913
929
 
914
930
  @module_command(
@@ -917,9 +933,9 @@ class TopK(ModuleGroup[AnyStr]):
917
933
  version_introduced="2.0.0",
918
934
  module=MODULE,
919
935
  flags={CommandFlag.READONLY},
920
- cache_config=CacheConfig(lambda *a, **_: a[0]),
936
+ cacheable=True,
921
937
  )
922
- async def info(self, key: KeyT) -> dict[AnyStr, int]:
938
+ def info(self, key: KeyT) -> CommandRequest[dict[AnyStr, int]]:
923
939
  """
924
940
  Returns information about a sketch
925
941
 
@@ -931,7 +947,7 @@ class TopK(ModuleGroup[AnyStr]):
931
947
  - ``decay``: The decay factor used by the sketch.
932
948
  """
933
949
 
934
- return await self.execute_module_command(
950
+ return self.client.create_request(
935
951
  CommandName.TOPK_INFO,
936
952
  key,
937
953
  callback=DictCallback[AnyStr, int](),
@@ -949,18 +965,20 @@ class TDigest(ModuleGroup[AnyStr]):
949
965
  version_introduced="2.4.0",
950
966
  module=MODULE,
951
967
  )
952
- async def create(self, key: KeyT, compression: int | None = None) -> bool:
968
+ def create(self, key: KeyT, compression: int | None = None) -> CommandRequest[bool]:
953
969
  """
954
970
  Allocates memory and initializes a new t-digest sketch
955
971
 
956
972
  :param key: The key name for the new t-digest sketch.
957
973
  :param compression: A controllable tradeoff between accuracy and memory consumption.
958
974
  """
959
- pieces: CommandArgList = [key]
975
+ command_arguments: CommandArgList = [key]
960
976
  if compression is not None:
961
- pieces.extend([PrefixToken.COMPRESSION, compression])
962
- return await self.execute_module_command(
963
- CommandName.TDIGEST_CREATE, *pieces, callback=SimpleStringCallback()
977
+ command_arguments.extend([PrefixToken.COMPRESSION, compression])
978
+ return self.client.create_request(
979
+ CommandName.TDIGEST_CREATE,
980
+ *command_arguments,
981
+ callback=SimpleStringCallback(),
964
982
  )
965
983
 
966
984
  @module_command(
@@ -969,13 +987,13 @@ class TDigest(ModuleGroup[AnyStr]):
969
987
  version_introduced="2.4.0",
970
988
  module=MODULE,
971
989
  )
972
- async def reset(self, key: KeyT) -> bool:
990
+ def reset(self, key: KeyT) -> CommandRequest[bool]:
973
991
  """
974
992
  Resets a t-digest sketch: empty the sketch and re-initializes it.
975
993
 
976
994
  :param key: The key name for an existing t-digest sketch.
977
995
  """
978
- return await self.execute_module_command(
996
+ return self.client.create_request(
979
997
  CommandName.TDIGEST_RESET, key, callback=SimpleStringCallback()
980
998
  )
981
999
 
@@ -985,21 +1003,23 @@ class TDigest(ModuleGroup[AnyStr]):
985
1003
  version_introduced="2.4.0",
986
1004
  module=MODULE,
987
1005
  )
988
- async def add(
1006
+ def add(
989
1007
  self,
990
1008
  key: KeyT,
991
1009
  values: Parameters[int | float],
992
- ) -> bool:
1010
+ ) -> CommandRequest[bool]:
993
1011
  """
994
1012
  Adds one or more observations to a t-digest sketch
995
1013
 
996
1014
  :param key: Key name for an existing t-digest sketch.
997
1015
  :param values: value(s) of observation(s)
998
1016
  """
999
- pieces: CommandArgList = [key, *values]
1017
+ command_arguments: CommandArgList = [key, *values]
1000
1018
 
1001
- return await self.execute_module_command(
1002
- CommandName.TDIGEST_ADD, *pieces, callback=SimpleStringCallback()
1019
+ return self.client.create_request(
1020
+ CommandName.TDIGEST_ADD,
1021
+ *command_arguments,
1022
+ callback=SimpleStringCallback(),
1003
1023
  )
1004
1024
 
1005
1025
  @module_command(
@@ -1008,13 +1028,13 @@ class TDigest(ModuleGroup[AnyStr]):
1008
1028
  version_introduced="2.4.0",
1009
1029
  module=MODULE,
1010
1030
  )
1011
- async def merge(
1031
+ def merge(
1012
1032
  self,
1013
1033
  destination_key: KeyT,
1014
1034
  source_keys: Parameters[KeyT],
1015
1035
  compression: int | None = None,
1016
1036
  override: bool | None = None,
1017
- ) -> bool:
1037
+ ) -> CommandRequest[bool]:
1018
1038
  """
1019
1039
  Merges multiple t-digest sketches into a single sketch
1020
1040
 
@@ -1029,17 +1049,19 @@ class TDigest(ModuleGroup[AnyStr]):
1029
1049
 
1030
1050
  """
1031
1051
  _source_keys: list[KeyT] = list(source_keys)
1032
- pieces: CommandArgList = [
1052
+ command_arguments: CommandArgList = [
1033
1053
  destination_key,
1034
1054
  len(_source_keys),
1035
1055
  *_source_keys,
1036
1056
  ]
1037
1057
  if compression is not None:
1038
- pieces.extend([PrefixToken.COMPRESSION, compression])
1058
+ command_arguments.extend([PrefixToken.COMPRESSION, compression])
1039
1059
  if override is not None:
1040
- pieces.append(PureToken.OVERRIDE)
1041
- return await self.execute_module_command(
1042
- CommandName.TDIGEST_MERGE, *pieces, callback=SimpleStringCallback()
1060
+ command_arguments.append(PureToken.OVERRIDE)
1061
+ return self.client.create_request(
1062
+ CommandName.TDIGEST_MERGE,
1063
+ *command_arguments,
1064
+ callback=SimpleStringCallback(),
1043
1065
  )
1044
1066
 
1045
1067
  @module_command(
@@ -1048,18 +1070,16 @@ class TDigest(ModuleGroup[AnyStr]):
1048
1070
  version_introduced="2.4.0",
1049
1071
  module=MODULE,
1050
1072
  flags={CommandFlag.READONLY},
1051
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1073
+ cacheable=True,
1052
1074
  )
1053
- async def min(self, key: KeyT) -> float:
1075
+ def min(self, key: KeyT) -> CommandRequest[float]:
1054
1076
  """
1055
1077
  Returns the minimum observation value from a t-digest sketch
1056
1078
 
1057
1079
  :param key: The key name for an existing t-digest sketch.
1058
1080
  """
1059
1081
 
1060
- return await self.execute_module_command(
1061
- CommandName.TDIGEST_MIN, key, callback=FloatCallback()
1062
- )
1082
+ return self.client.create_request(CommandName.TDIGEST_MIN, key, callback=FloatCallback())
1063
1083
 
1064
1084
  @module_command(
1065
1085
  CommandName.TDIGEST_MAX,
@@ -1067,18 +1087,16 @@ class TDigest(ModuleGroup[AnyStr]):
1067
1087
  version_introduced="2.4.0",
1068
1088
  module=MODULE,
1069
1089
  flags={CommandFlag.READONLY},
1070
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1090
+ cacheable=True,
1071
1091
  )
1072
- async def max(self, key: KeyT) -> float:
1092
+ def max(self, key: KeyT) -> CommandRequest[float]:
1073
1093
  """
1074
1094
  Returns the maximum observation value from a t-digest sketch
1075
1095
 
1076
1096
  :param key: The key name for an existing t-digest sketch.
1077
1097
  """
1078
1098
 
1079
- return await self.execute_module_command(
1080
- CommandName.TDIGEST_MAX, key, callback=FloatCallback()
1081
- )
1099
+ return self.client.create_request(CommandName.TDIGEST_MAX, key, callback=FloatCallback())
1082
1100
 
1083
1101
  @module_command(
1084
1102
  CommandName.TDIGEST_QUANTILE,
@@ -1086,13 +1104,13 @@ class TDigest(ModuleGroup[AnyStr]):
1086
1104
  version_introduced="2.4.0",
1087
1105
  module=MODULE,
1088
1106
  flags={CommandFlag.READONLY},
1089
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1107
+ cacheable=True,
1090
1108
  )
1091
- async def quantile(
1109
+ def quantile(
1092
1110
  self,
1093
1111
  key: KeyT,
1094
1112
  quantiles: Parameters[int | float],
1095
- ) -> tuple[float, ...]:
1113
+ ) -> CommandRequest[tuple[float, ...]]:
1096
1114
  """
1097
1115
  Returns, for each input fraction, an estimation of the value (floating point)
1098
1116
  that is smaller than the given fraction of observations
@@ -1100,10 +1118,10 @@ class TDigest(ModuleGroup[AnyStr]):
1100
1118
  :param key: Key name for an existing t-digest sketch.
1101
1119
  :param quantiles: Input fractions (between 0 and 1 inclusively).
1102
1120
  """
1103
- pieces: CommandArgList = [key, *quantiles]
1121
+ command_arguments: CommandArgList = [key, *quantiles]
1104
1122
 
1105
- return await self.execute_module_command(
1106
- CommandName.TDIGEST_QUANTILE, *pieces, callback=FloatsCallback()
1123
+ return self.client.create_request(
1124
+ CommandName.TDIGEST_QUANTILE, *command_arguments, callback=FloatsCallback()
1107
1125
  )
1108
1126
 
1109
1127
  @module_command(
@@ -1112,13 +1130,13 @@ class TDigest(ModuleGroup[AnyStr]):
1112
1130
  version_introduced="2.4.0",
1113
1131
  module=MODULE,
1114
1132
  flags={CommandFlag.READONLY},
1115
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1133
+ cacheable=True,
1116
1134
  )
1117
- async def cdf(
1135
+ def cdf(
1118
1136
  self,
1119
1137
  key: KeyT,
1120
1138
  values: Parameters[int | float],
1121
- ) -> tuple[float, ...]:
1139
+ ) -> CommandRequest[tuple[float, ...]]:
1122
1140
  """
1123
1141
  Returns, for each input value, an estimation of the fraction (floating-point)
1124
1142
  of (observations smaller than the given value + half the observations equal
@@ -1127,10 +1145,10 @@ class TDigest(ModuleGroup[AnyStr]):
1127
1145
  :param key: The key name for an existing t-digest sketch.
1128
1146
  :param values: The values for which the CDF should be retrieved.
1129
1147
  """
1130
- pieces: CommandArgList = [key, *values]
1148
+ command_arguments: CommandArgList = [key, *values]
1131
1149
 
1132
- return await self.execute_module_command(
1133
- CommandName.TDIGEST_CDF, *pieces, callback=FloatsCallback()
1150
+ return self.client.create_request(
1151
+ CommandName.TDIGEST_CDF, *command_arguments, callback=FloatsCallback()
1134
1152
  )
1135
1153
 
1136
1154
  @module_command(
@@ -1139,14 +1157,14 @@ class TDigest(ModuleGroup[AnyStr]):
1139
1157
  version_introduced="2.4.0",
1140
1158
  module=MODULE,
1141
1159
  flags={CommandFlag.READONLY},
1142
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1160
+ cacheable=True,
1143
1161
  )
1144
- async def trimmed_mean(
1162
+ def trimmed_mean(
1145
1163
  self,
1146
1164
  key: KeyT,
1147
1165
  low_cut_quantile: int | float,
1148
1166
  high_cut_quantile: int | float,
1149
- ) -> float:
1167
+ ) -> CommandRequest[float]:
1150
1168
  """
1151
1169
  Returns an estimation of the mean value from the sketch,
1152
1170
  excluding observation values outside the low and high cutoff quantiles
@@ -1158,10 +1176,12 @@ class TDigest(ModuleGroup[AnyStr]):
1158
1176
  should be higher than `low_cut_quantile`.
1159
1177
 
1160
1178
  """
1161
- pieces: CommandArgList = [key, low_cut_quantile, high_cut_quantile]
1179
+ command_arguments: CommandArgList = [key, low_cut_quantile, high_cut_quantile]
1162
1180
 
1163
- return await self.execute_module_command(
1164
- CommandName.TDIGEST_TRIMMED_MEAN, *pieces, callback=FloatCallback()
1181
+ return self.client.create_request(
1182
+ CommandName.TDIGEST_TRIMMED_MEAN,
1183
+ *command_arguments,
1184
+ callback=FloatCallback(),
1165
1185
  )
1166
1186
 
1167
1187
  @module_command(
@@ -1170,13 +1190,13 @@ class TDigest(ModuleGroup[AnyStr]):
1170
1190
  version_introduced="2.4.0",
1171
1191
  module=MODULE,
1172
1192
  flags={CommandFlag.READONLY},
1173
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1193
+ cacheable=True,
1174
1194
  )
1175
- async def rank(
1195
+ def rank(
1176
1196
  self,
1177
1197
  key: KeyT,
1178
1198
  values: Parameters[int | float],
1179
- ) -> tuple[int, ...]:
1199
+ ) -> CommandRequest[tuple[int, ...]]:
1180
1200
  """
1181
1201
  Returns, for each input value (floating-point), the estimated rank of
1182
1202
  the value (the number of observations in the sketch that are smaller
@@ -1185,10 +1205,10 @@ class TDigest(ModuleGroup[AnyStr]):
1185
1205
  :param key: The key name for an existing t-digest sketch.
1186
1206
  :param values: Input values for which the rank should be estimated.
1187
1207
  """
1188
- pieces: CommandArgList = [key, *values]
1208
+ command_arguments: CommandArgList = [key, *values]
1189
1209
 
1190
- return await self.execute_module_command(
1191
- CommandName.TDIGEST_RANK, *pieces, callback=TupleCallback[int]()
1210
+ return self.client.create_request(
1211
+ CommandName.TDIGEST_RANK, *command_arguments, callback=TupleCallback[int]()
1192
1212
  )
1193
1213
 
1194
1214
  @module_command(
@@ -1197,13 +1217,13 @@ class TDigest(ModuleGroup[AnyStr]):
1197
1217
  version_introduced="2.4.0",
1198
1218
  module=MODULE,
1199
1219
  flags={CommandFlag.READONLY},
1200
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1220
+ cacheable=True,
1201
1221
  )
1202
- async def revrank(
1222
+ def revrank(
1203
1223
  self,
1204
1224
  key: KeyT,
1205
1225
  values: Parameters[int | float],
1206
- ) -> tuple[int, ...]:
1226
+ ) -> CommandRequest[tuple[int, ...]]:
1207
1227
  """
1208
1228
  Returns, for each input value (floating-point), the estimated reverse rank of
1209
1229
  the value (the number of observations in the sketch that are larger than
@@ -1212,10 +1232,12 @@ class TDigest(ModuleGroup[AnyStr]):
1212
1232
  :param key: The name of an existing t-digest sketch.
1213
1233
  :param values: The input values for which the reverse rank should be estimated.
1214
1234
  """
1215
- pieces: CommandArgList = [key, *values]
1235
+ command_arguments: CommandArgList = [key, *values]
1216
1236
 
1217
- return await self.execute_module_command(
1218
- CommandName.TDIGEST_REVRANK, *pieces, callback=TupleCallback[int]()
1237
+ return self.client.create_request(
1238
+ CommandName.TDIGEST_REVRANK,
1239
+ *command_arguments,
1240
+ callback=TupleCallback[int](),
1219
1241
  )
1220
1242
 
1221
1243
  @module_command(
@@ -1224,13 +1246,13 @@ class TDigest(ModuleGroup[AnyStr]):
1224
1246
  version_introduced="2.4.0",
1225
1247
  module=MODULE,
1226
1248
  flags={CommandFlag.READONLY},
1227
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1249
+ cacheable=True,
1228
1250
  )
1229
- async def byrank(
1251
+ def byrank(
1230
1252
  self,
1231
1253
  key: KeyT,
1232
1254
  ranks: Parameters[int | float],
1233
- ) -> tuple[float, ...]:
1255
+ ) -> CommandRequest[tuple[float, ...]]:
1234
1256
  """
1235
1257
  Returns, for each input rank, an estimation of the value (floating-point) with
1236
1258
  that rank
@@ -1238,10 +1260,10 @@ class TDigest(ModuleGroup[AnyStr]):
1238
1260
  :param key: The key name for an existing t-digest sketch.
1239
1261
  :param ranks: The ranks for which the estimated values should be retrieved.
1240
1262
  """
1241
- pieces: CommandArgList = [key, *ranks]
1263
+ command_arguments: CommandArgList = [key, *ranks]
1242
1264
 
1243
- return await self.execute_module_command(
1244
- CommandName.TDIGEST_BYRANK, *pieces, callback=FloatsCallback()
1265
+ return self.client.create_request(
1266
+ CommandName.TDIGEST_BYRANK, *command_arguments, callback=FloatsCallback()
1245
1267
  )
1246
1268
 
1247
1269
  @module_command(
@@ -1250,13 +1272,13 @@ class TDigest(ModuleGroup[AnyStr]):
1250
1272
  version_introduced="2.4.0",
1251
1273
  module=MODULE,
1252
1274
  flags={CommandFlag.READONLY},
1253
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1275
+ cacheable=True,
1254
1276
  )
1255
- async def byrevrank(
1277
+ def byrevrank(
1256
1278
  self,
1257
1279
  key: KeyT,
1258
1280
  reverse_ranks: Parameters[int | float],
1259
- ) -> tuple[float, ...]:
1281
+ ) -> CommandRequest[tuple[float, ...]]:
1260
1282
  """
1261
1283
  Returns, for each input reverse rank, an estimation of the value
1262
1284
  (floating-point) with that reverse rank
@@ -1264,10 +1286,12 @@ class TDigest(ModuleGroup[AnyStr]):
1264
1286
  :param key: The key name for an existing t-digest sketch.
1265
1287
  :param reverse_ranks: The reverse ranks for which the values should be retrieved.
1266
1288
  """
1267
- pieces: CommandArgList = [key, *reverse_ranks]
1289
+ command_arguments: CommandArgList = [key, *reverse_ranks]
1268
1290
 
1269
- return await self.execute_module_command(
1270
- CommandName.TDIGEST_BYREVRANK, *pieces, callback=FloatsCallback()
1291
+ return self.client.create_request(
1292
+ CommandName.TDIGEST_BYREVRANK,
1293
+ *command_arguments,
1294
+ callback=FloatsCallback(),
1271
1295
  )
1272
1296
 
1273
1297
  @module_command(
@@ -1276,9 +1300,9 @@ class TDigest(ModuleGroup[AnyStr]):
1276
1300
  version_introduced="2.4.0",
1277
1301
  module=MODULE,
1278
1302
  flags={CommandFlag.READONLY},
1279
- cache_config=CacheConfig(lambda *a, **_: a[0]),
1303
+ cacheable=True,
1280
1304
  )
1281
- async def info(self, key: KeyT) -> dict[AnyStr, ResponsePrimitive]:
1305
+ def info(self, key: KeyT) -> CommandRequest[dict[AnyStr, ResponsePrimitive]]:
1282
1306
  """
1283
1307
  Returns information and statistics about a t-digest sketch
1284
1308
 
@@ -1288,7 +1312,7 @@ class TDigest(ModuleGroup[AnyStr]):
1288
1312
  number of observations, total compressions, and memory usage.
1289
1313
  """
1290
1314
 
1291
- return await self.execute_module_command(
1315
+ return self.client.create_request(
1292
1316
  CommandName.TDIGEST_INFO,
1293
1317
  key,
1294
1318
  callback=DictCallback[AnyStr, ResponsePrimitive](),