valkey-glide 2.0.0__cp39-cp39-macosx_11_0_arm64.whl → 2.2.2__cp39-cp39-macosx_11_0_arm64.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.
Files changed (44) hide show
  1. glide/__init__.py +152 -118
  2. glide/async_commands/cluster_commands.py +29 -14
  3. glide/async_commands/core.py +600 -414
  4. glide/async_commands/{server_modules/ft.py → ft.py} +8 -7
  5. glide/async_commands/{server_modules/glide_json.py → glide_json.py} +15 -92
  6. glide/async_commands/standalone_commands.py +10 -51
  7. glide/glide.cpython-39-darwin.so +0 -0
  8. glide/glide.pyi +1 -1
  9. glide/glide_client.py +54 -48
  10. glide/logger.py +3 -3
  11. glide/opentelemetry.py +8 -4
  12. glide_shared/__init__.py +330 -0
  13. glide_shared/commands/__init__.py +0 -0
  14. {glide/async_commands → glide_shared/commands}/batch.py +426 -32
  15. {glide/async_commands → glide_shared/commands}/batch_options.py +1 -1
  16. glide_shared/commands/core_options.py +407 -0
  17. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_aggregate_options.py +3 -3
  18. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_create_options.py +4 -2
  19. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_profile_options.py +4 -4
  20. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_search_options.py +4 -2
  21. {glide/async_commands → glide_shared/commands}/server_modules/json_batch.py +4 -4
  22. glide_shared/commands/server_modules/json_options.py +93 -0
  23. {glide/async_commands → glide_shared/commands}/sorted_set.py +2 -2
  24. {glide/async_commands → glide_shared/commands}/stream.py +1 -1
  25. {glide → glide_shared}/config.py +302 -58
  26. {glide → glide_shared}/constants.py +3 -3
  27. {glide → glide_shared}/exceptions.py +27 -1
  28. glide_shared/protobuf/command_request_pb2.py +56 -0
  29. glide_shared/protobuf/connection_request_pb2.py +56 -0
  30. {glide → glide_shared}/routes.py +29 -15
  31. {valkey_glide-2.0.0.dist-info → valkey_glide-2.2.2.dist-info}/METADATA +120 -58
  32. valkey_glide-2.2.2.dist-info/RECORD +40 -0
  33. glide/protobuf/command_request_pb2.py +0 -54
  34. glide/protobuf/command_request_pb2.pyi +0 -1193
  35. glide/protobuf/connection_request_pb2.py +0 -52
  36. glide/protobuf/connection_request_pb2.pyi +0 -299
  37. glide/protobuf/response_pb2.pyi +0 -106
  38. valkey_glide-2.0.0.dist-info/RECORD +0 -39
  39. {glide/async_commands → glide_shared/commands}/bitmap.py +0 -0
  40. {glide/async_commands → glide_shared/commands}/command_args.py +0 -0
  41. {glide/async_commands → glide_shared/commands}/server_modules/ft_options/ft_constants.py +0 -0
  42. {glide → glide_shared}/protobuf/response_pb2.py +0 -0
  43. {glide → glide_shared}/protobuf_codec.py +0 -0
  44. {valkey_glide-2.0.0.dist-info → valkey_glide-2.2.2.dist-info}/WHEEL +0 -0
@@ -4,7 +4,7 @@ import sys
4
4
  import threading
5
5
  from typing import List, Mapping, Optional, Tuple, TypeVar, Union
6
6
 
7
- from glide.async_commands.bitmap import (
7
+ from glide_shared.commands.bitmap import (
8
8
  BitFieldGet,
9
9
  BitFieldSubCommands,
10
10
  BitwiseOperation,
@@ -12,26 +12,27 @@ from glide.async_commands.bitmap import (
12
12
  _create_bitfield_args,
13
13
  _create_bitfield_read_only_args,
14
14
  )
15
- from glide.async_commands.command_args import Limit, ListDirection, OrderBy
16
- from glide.async_commands.core import (
15
+ from glide_shared.commands.command_args import Limit, ListDirection, OrderBy
16
+ from glide_shared.commands.core_options import (
17
17
  ConditionalChange,
18
18
  ExpireOptions,
19
19
  ExpiryGetEx,
20
20
  ExpirySet,
21
21
  FlushMode,
22
22
  FunctionRestorePolicy,
23
- GeospatialData,
24
- GeoUnit,
23
+ HashFieldConditionalChange,
25
24
  InfoSection,
26
25
  InsertPosition,
27
26
  UpdateOptions,
28
27
  _build_sort_args,
29
28
  )
30
- from glide.async_commands.sorted_set import (
29
+ from glide_shared.commands.sorted_set import (
31
30
  AggregationType,
32
31
  GeoSearchByBox,
33
32
  GeoSearchByRadius,
34
33
  GeoSearchCount,
34
+ GeospatialData,
35
+ GeoUnit,
35
36
  InfBound,
36
37
  LexBoundary,
37
38
  RangeByIndex,
@@ -43,7 +44,7 @@ from glide.async_commands.sorted_set import (
43
44
  _create_zinter_zunion_cmd_args,
44
45
  _create_zrange_args,
45
46
  )
46
- from glide.async_commands.stream import (
47
+ from glide_shared.commands.stream import (
47
48
  StreamAddOptions,
48
49
  StreamClaimOptions,
49
50
  StreamGroupOptions,
@@ -54,9 +55,9 @@ from glide.async_commands.stream import (
54
55
  StreamTrimOptions,
55
56
  _create_xpending_range_args,
56
57
  )
57
- from glide.constants import TEncodable
58
- from glide.exceptions import RequestError
59
- from glide.protobuf.command_request_pb2 import RequestType
58
+ from glide_shared.constants import TEncodable
59
+ from glide_shared.exceptions import RequestError
60
+ from glide_shared.protobuf.command_request_pb2 import RequestType
60
61
 
61
62
  if sys.version_info >= (3, 13):
62
63
  from warnings import deprecated
@@ -402,6 +403,27 @@ class BaseBatch:
402
403
  """
403
404
  return self.append_command(RequestType.ConfigResetStat, [])
404
405
 
406
+ def move(self: TBatch, key: TEncodable, db_index: int) -> "TBatch":
407
+ """
408
+ Move `key` from the currently selected database to the database specified by `db_index`.
409
+
410
+ Note:
411
+ For cluster mode move command is supported since Valkey 9.0.0
412
+
413
+ See [valkey.io](https://valkey.io/commands/move/) for more details.
414
+
415
+ Args:
416
+ key (TEncodable): The key to move.
417
+ db_index (int): The index of the database to move `key` to.
418
+
419
+ Commands response:
420
+ bool: True if `key` was moved.
421
+
422
+ False if the `key` already exists in the destination database
423
+ or does not exist in the source database.
424
+ """
425
+ return self.append_command(RequestType.Move, [key, str(db_index)])
426
+
405
427
  def mset(self: TBatch, key_value_map: Mapping[TEncodable, TEncodable]) -> TBatch:
406
428
  """
407
429
  Set multiple keys to multiple values in a single atomic operation.
@@ -956,6 +978,391 @@ class BaseBatch:
956
978
  """
957
979
  return self.append_command(RequestType.HStrlen, [key, field])
958
980
 
981
+ def httl(self: TBatch, key: TEncodable, fields: List[TEncodable]) -> TBatch:
982
+ """
983
+ Returns the remaining time to live (in seconds) of hash key's field(s) that have an associated expiration.
984
+
985
+ See [valkey.io](https://valkey.io/commands/httl/) for more details.
986
+
987
+ Args:
988
+ key (TEncodable): The key of the hash.
989
+ fields (List[TEncodable]): The list of fields to get TTL for.
990
+
991
+ Commands response:
992
+ List[int]: A list of TTL values for each field:
993
+ - Positive integer: remaining TTL in seconds
994
+ - `-1`: field exists but has no expiration
995
+ - `-2`: field does not exist or key does not exist
996
+
997
+ Since: Valkey 9.0.0
998
+ """
999
+ return self.append_command(
1000
+ RequestType.HTtl, [key, "FIELDS", str(len(fields))] + fields
1001
+ )
1002
+
1003
+ def hpttl(self: TBatch, key: TEncodable, fields: List[TEncodable]) -> TBatch:
1004
+ """
1005
+ Returns the remaining time to live (in milliseconds) of hash key's field(s) that have an associated expiration.
1006
+
1007
+ See [valkey.io](https://valkey.io/commands/hpttl/) for more details.
1008
+
1009
+ Args:
1010
+ key (TEncodable): The key of the hash.
1011
+ fields (List[TEncodable]): The list of fields to get TTL for.
1012
+
1013
+ Commands response:
1014
+ List[int]: A list of TTL values for each field:
1015
+ - Positive integer: remaining TTL in milliseconds
1016
+ - `-1`: field exists but has no expiration
1017
+ - `-2`: field does not exist or key does not exist
1018
+
1019
+ Since: Valkey 9.0.0
1020
+ """
1021
+ return self.append_command(
1022
+ RequestType.HPTtl, [key, "FIELDS", str(len(fields))] + fields
1023
+ )
1024
+
1025
+ def hexpiretime(self: TBatch, key: TEncodable, fields: List[TEncodable]) -> TBatch:
1026
+ """
1027
+ Returns the expiration Unix timestamp (in seconds) of hash key's field(s) that have an associated expiration.
1028
+
1029
+ See [valkey.io](https://valkey.io/commands/hexpiretime/) for more details.
1030
+
1031
+ Args:
1032
+ key (TEncodable): The key of the hash.
1033
+ fields (List[TEncodable]): The list of fields to get expiration timestamps for.
1034
+
1035
+ Commands response:
1036
+ List[int]: A list of expiration timestamps for each field:
1037
+ - Positive integer: absolute expiration timestamp in seconds (Unix timestamp)
1038
+ - `-1`: field exists but has no expiration
1039
+ - `-2`: field does not exist or key does not exist
1040
+
1041
+ Since: Valkey 9.0.0
1042
+ """
1043
+ return self.append_command(
1044
+ RequestType.HExpireTime, [key, "FIELDS", str(len(fields))] + fields
1045
+ )
1046
+
1047
+ def hpexpiretime(self: TBatch, key: TEncodable, fields: List[TEncodable]) -> TBatch:
1048
+ """
1049
+ Returns the expiration Unix timestamp (in milliseconds) of hash key's field(s) that have an associated expiration.
1050
+
1051
+ See [valkey.io](https://valkey.io/commands/hpexpiretime/) for more details.
1052
+
1053
+ Args:
1054
+ key (TEncodable): The key of the hash.
1055
+ fields (List[TEncodable]): The list of fields to get expiration timestamps for.
1056
+
1057
+ Returns:
1058
+ TBatch: The batch object for method chaining.
1059
+
1060
+ Command Response:
1061
+ List[int]: A list of expiration timestamps for each field:
1062
+ - Positive integer: absolute expiration timestamp in milliseconds (Unix timestamp in ms)
1063
+ - `-1`: field exists but has no expiration
1064
+ - `-2`: field does not exist or key does not exist
1065
+
1066
+ Since: Valkey 9.0.0
1067
+ """
1068
+ return self.append_command(
1069
+ RequestType.HPExpireTime, [key, "FIELDS", str(len(fields))] + fields
1070
+ )
1071
+
1072
+ def hsetex(
1073
+ self: TBatch,
1074
+ key: TEncodable,
1075
+ field_value_map: Mapping[TEncodable, TEncodable],
1076
+ field_conditional_change: Optional[HashFieldConditionalChange] = None,
1077
+ expiry: Optional[ExpirySet] = None,
1078
+ ) -> TBatch:
1079
+ """
1080
+ Sets the specified fields to their respective values in the hash stored at `key` with optional expiration.
1081
+
1082
+ See [valkey.io](https://valkey.io/commands/hsetex/) for more details.
1083
+
1084
+ Args:
1085
+ key (TEncodable): The key of the hash.
1086
+ field_value_map (Mapping[TEncodable, TEncodable]): A field-value map consisting of fields and their corresponding
1087
+ values to be set in the hash stored at the specified key.
1088
+ field_conditional_change (Optional[HashFieldConditionalChange]): Field conditional change option:
1089
+ - ONLY_IF_ALL_EXIST (FXX): Only set fields if all of them already exist.
1090
+ - ONLY_IF_NONE_EXIST (FNX): Only set fields if none of them already exist.
1091
+ expiry (Optional[ExpirySet]): Expiration options for the fields:
1092
+ - EX: Expiration time in seconds.
1093
+ - PX: Expiration time in milliseconds.
1094
+ - EXAT: Absolute expiration time in seconds (Unix timestamp).
1095
+ - PXAT: Absolute expiration time in milliseconds (Unix timestamp).
1096
+ - KEEPTTL: Retain existing TTL.
1097
+
1098
+ Commands response:
1099
+ int: 1 if all fields were set successfully, 0 if none were set due to conditional constraints.
1100
+
1101
+ Since: Valkey 9.0.0
1102
+ """
1103
+ args: List[TEncodable] = [key]
1104
+
1105
+ # Add field conditional change option if specified
1106
+ if field_conditional_change is not None:
1107
+ args.append(field_conditional_change.value)
1108
+
1109
+ # Add expiry options if specified
1110
+ if expiry is not None:
1111
+ args.extend(expiry.get_cmd_args())
1112
+
1113
+ # Add FIELDS keyword and field count
1114
+ args.extend(["FIELDS", str(len(field_value_map))])
1115
+
1116
+ # Add field-value pairs
1117
+ for field, value in field_value_map.items():
1118
+ args.extend([field, value])
1119
+
1120
+ return self.append_command(RequestType.HSetEx, args)
1121
+
1122
+ def hgetex(
1123
+ self: TBatch,
1124
+ key: TEncodable,
1125
+ fields: List[TEncodable],
1126
+ expiry: Optional[ExpiryGetEx] = None,
1127
+ ) -> TBatch:
1128
+ """
1129
+ Retrieves the values of specified fields in the hash stored at `key` and optionally sets their expiration.
1130
+
1131
+ See [valkey.io](https://valkey.io/commands/hgetex/) for more details.
1132
+
1133
+ Args:
1134
+ key (TEncodable): The key of the hash.
1135
+ fields (List[TEncodable]): The list of fields to retrieve from the hash.
1136
+ expiry (Optional[ExpiryGetEx]): Expiration options for the retrieved fields:
1137
+ - EX: Expiration time in seconds.
1138
+ - PX: Expiration time in milliseconds.
1139
+ - EXAT: Absolute expiration time in seconds (Unix timestamp).
1140
+ - PXAT: Absolute expiration time in milliseconds (Unix timestamp).
1141
+ - PERSIST: Remove expiration from the fields.
1142
+
1143
+ Commands response:
1144
+ Optional[List[Optional[bytes]]]: A list of values associated with the given fields, in the same order as requested.
1145
+ For every field that does not exist in the hash, a null value is returned.
1146
+ If `key` does not exist, it is treated as an empty hash, and the function returns a list of null values.
1147
+
1148
+ Since: Valkey 9.0.0
1149
+ """
1150
+ args: List[TEncodable] = [key]
1151
+
1152
+ # Add expiry options if specified
1153
+ if expiry is not None:
1154
+ args.extend(expiry.get_cmd_args())
1155
+
1156
+ # Add FIELDS keyword and field count
1157
+ args.extend(["FIELDS", str(len(fields))])
1158
+
1159
+ # Add fields
1160
+ args.extend(fields)
1161
+
1162
+ return self.append_command(RequestType.HGetEx, args)
1163
+
1164
+ def hexpire(
1165
+ self: TBatch,
1166
+ key: TEncodable,
1167
+ seconds: int,
1168
+ fields: List[TEncodable],
1169
+ option: Optional[ExpireOptions] = None,
1170
+ ) -> TBatch:
1171
+ """
1172
+ Sets expiration time in seconds for one or more hash fields.
1173
+
1174
+ See [valkey.io](https://valkey.io/commands/hexpire/) for more details.
1175
+
1176
+ Args:
1177
+ key (TEncodable): The key of the hash.
1178
+ seconds (int): The expiration time in seconds.
1179
+ fields (List[TEncodable]): The list of fields to set expiration for.
1180
+ option (Optional[ExpireOptions]): Conditional expiration option:
1181
+ - HasNoExpiry (NX): Set expiration only when the field has no expiry.
1182
+ - HasExistingExpiry (XX): Set expiration only when the field has an existing expiry.
1183
+ - NewExpiryGreaterThanCurrent (GT): Set expiration only when the new expiry is greater than the current one.
1184
+ - NewExpiryLessThanCurrent (LT): Set expiration only when the new expiry is less than the current one.
1185
+
1186
+ Commands response:
1187
+ List[int]: A list of status codes for each field:
1188
+ - `1`: Expiration time was applied successfully.
1189
+ - `0`: Specified condition was not met.
1190
+ - `-2`: Field does not exist or key does not exist.
1191
+ - `2`: Field was deleted immediately (when seconds is 0 or timestamp is in the past).
1192
+
1193
+ Since: Valkey 9.0.0
1194
+ """
1195
+ args: List[TEncodable] = [key, str(seconds)]
1196
+
1197
+ # Add conditional option if specified
1198
+ if option is not None:
1199
+ args.append(option.value)
1200
+
1201
+ # Add FIELDS keyword and field count
1202
+ args.extend(["FIELDS", str(len(fields))])
1203
+
1204
+ # Add fields
1205
+ args.extend(fields)
1206
+
1207
+ return self.append_command(RequestType.HExpire, args)
1208
+
1209
+ def hpersist(self: TBatch, key: TEncodable, fields: List[TEncodable]) -> TBatch:
1210
+ """
1211
+ Removes the expiration from one or more hash fields, making them persistent.
1212
+
1213
+ See [valkey.io](https://valkey.io/commands/hpersist/) for more details.
1214
+
1215
+ Args:
1216
+ key (TEncodable): The key of the hash.
1217
+ fields (List[TEncodable]): The list of fields to remove expiration from.
1218
+
1219
+ Commands response:
1220
+ List[int]: A list of status codes for each field:
1221
+ - `1`: Expiration was removed successfully (field became persistent).
1222
+ - `-1`: Field exists but has no expiration.
1223
+ - `-2`: Field does not exist or key does not exist.
1224
+
1225
+ Since: Valkey 9.0.0
1226
+ """
1227
+ args: List[TEncodable] = [key, "FIELDS", str(len(fields))] + fields
1228
+
1229
+ return self.append_command(RequestType.HPersist, args)
1230
+
1231
+ def hpexpire(
1232
+ self: TBatch,
1233
+ key: TEncodable,
1234
+ milliseconds: int,
1235
+ fields: List[TEncodable],
1236
+ option: Optional[ExpireOptions] = None,
1237
+ ) -> TBatch:
1238
+ """
1239
+ Sets expiration time in milliseconds for one or more hash fields.
1240
+
1241
+ See [valkey.io](https://valkey.io/commands/hpexpire/) for more details.
1242
+
1243
+ Args:
1244
+ key (TEncodable): The key of the hash.
1245
+ milliseconds (int): The expiration time in milliseconds.
1246
+ fields (List[TEncodable]): The list of fields to set expiration for.
1247
+ option (Optional[ExpireOptions]): Conditional expiration option:
1248
+ - HasNoExpiry (NX): Set expiration only when the field has no expiry.
1249
+ - HasExistingExpiry (XX): Set expiration only when the field has an existing expiry.
1250
+ - NewExpiryGreaterThanCurrent (GT): Set expiration only when the new expiry is greater than the current one.
1251
+ - NewExpiryLessThanCurrent (LT): Set expiration only when the new expiry is less than the current one.
1252
+
1253
+ Commands response:
1254
+ List[int]: A list of status codes for each field:
1255
+ - `1`: Expiration time was applied successfully.
1256
+ - `0`: Specified condition was not met.
1257
+ - `-2`: Field does not exist or key does not exist.
1258
+ - `2`: Field was deleted immediately (when milliseconds is 0 or timestamp is in the past).
1259
+
1260
+ Since: Valkey 9.0.0
1261
+ """
1262
+ args: List[TEncodable] = [key, str(milliseconds)]
1263
+
1264
+ # Add conditional option if specified
1265
+ if option is not None:
1266
+ args.append(option.value)
1267
+
1268
+ # Add FIELDS keyword and field count
1269
+ args.extend(["FIELDS", str(len(fields))])
1270
+
1271
+ # Add fields
1272
+ args.extend(fields)
1273
+
1274
+ return self.append_command(RequestType.HPExpire, args)
1275
+
1276
+ def hexpireat(
1277
+ self: TBatch,
1278
+ key: TEncodable,
1279
+ unix_timestamp: int,
1280
+ fields: List[TEncodable],
1281
+ option: Optional[ExpireOptions] = None,
1282
+ ) -> TBatch:
1283
+ """
1284
+ Sets expiration time at absolute Unix timestamp in seconds for one or more hash fields.
1285
+
1286
+ See [valkey.io](https://valkey.io/commands/hexpireat/) for more details.
1287
+
1288
+ Args:
1289
+ key (TEncodable): The key of the hash.
1290
+ unix_timestamp (int): The absolute expiration time as Unix timestamp in seconds.
1291
+ fields (List[TEncodable]): The list of fields to set expiration for.
1292
+ option (Optional[ExpireOptions]): Conditional expiration option:
1293
+ - HasNoExpiry (NX): Set expiration only when the field has no expiry.
1294
+ - HasExistingExpiry (XX): Set expiration only when the field has an existing expiry.
1295
+ - NewExpiryGreaterThanCurrent (GT): Set expiration only when the new expiry is greater than the current one.
1296
+ - NewExpiryLessThanCurrent (LT): Set expiration only when the new expiry is less than the current one.
1297
+
1298
+ Commands response:
1299
+ List[int]: A list of status codes for each field:
1300
+ - `1`: Expiration time was applied successfully.
1301
+ - `0`: Specified condition was not met.
1302
+ - `-2`: Field does not exist or key does not exist.
1303
+ - `2`: Field was deleted immediately (when timestamp is in the past).
1304
+
1305
+ Since: Valkey 9.0.0
1306
+ """
1307
+ args: List[TEncodable] = [key, str(unix_timestamp)]
1308
+
1309
+ # Add conditional option if specified
1310
+ if option is not None:
1311
+ args.append(option.value)
1312
+
1313
+ # Add FIELDS keyword and field count
1314
+ args.extend(["FIELDS", str(len(fields))])
1315
+
1316
+ # Add fields
1317
+ args.extend(fields)
1318
+
1319
+ return self.append_command(RequestType.HExpireAt, args)
1320
+
1321
+ def hpexpireat(
1322
+ self: TBatch,
1323
+ key: TEncodable,
1324
+ unix_timestamp_ms: int,
1325
+ fields: List[TEncodable],
1326
+ option: Optional[ExpireOptions] = None,
1327
+ ) -> TBatch:
1328
+ """
1329
+ Sets expiration time at absolute Unix timestamp in milliseconds for one or more hash fields.
1330
+
1331
+ See [valkey.io](https://valkey.io/commands/hpexpireat/) for more details.
1332
+
1333
+ Args:
1334
+ key (TEncodable): The key of the hash.
1335
+ unix_timestamp_ms (int): The absolute expiration time as Unix timestamp in milliseconds.
1336
+ fields (List[TEncodable]): The list of fields to set expiration for.
1337
+ option (Optional[ExpireOptions]): Conditional expiration option:
1338
+ - HasNoExpiry (NX): Set expiration only when the field has no expiry.
1339
+ - HasExistingExpiry (XX): Set expiration only when the field has an existing expiry.
1340
+ - NewExpiryGreaterThanCurrent (GT): Set expiration only when the new expiry is greater than the current one.
1341
+ - NewExpiryLessThanCurrent (LT): Set expiration only when the new expiry is less than the current one.
1342
+
1343
+ Commands response:
1344
+ List[int]: A list of status codes for each field:
1345
+ - `1`: Expiration time was applied successfully.
1346
+ - `0`: Specified condition was not met.
1347
+ - `-2`: Field does not exist or key does not exist.
1348
+ - `2`: Field was deleted immediately (when timestamp is in the past).
1349
+
1350
+ Since: Valkey 9.0.0
1351
+ """
1352
+ args: List[TEncodable] = [key, str(unix_timestamp_ms)]
1353
+
1354
+ # Add conditional option if specified
1355
+ if option is not None:
1356
+ args.append(option.value)
1357
+
1358
+ # Add FIELDS keyword and field count
1359
+ args.extend(["FIELDS", str(len(fields))])
1360
+
1361
+ # Add fields
1362
+ args.extend(fields)
1363
+
1364
+ return self.append_command(RequestType.HPExpireAt, args)
1365
+
959
1366
  def lpush(self: TBatch, key: TEncodable, elements: List[TEncodable]) -> TBatch:
960
1367
  """
961
1368
  Insert all the specified values at the head of the list stored at `key`.
@@ -4684,7 +5091,7 @@ class BaseBatch:
4684
5091
  args.extend(["VERSION", str(version)])
4685
5092
  if parameters:
4686
5093
  for var in parameters:
4687
- args.extend(str(var))
5094
+ args.append(str(var))
4688
5095
  return self.append_command(RequestType.Lolwut, args)
4689
5096
 
4690
5097
  def random_key(self: TBatch) -> TBatch:
@@ -5368,25 +5775,6 @@ class Batch(BaseBatch):
5368
5775
 
5369
5776
  """
5370
5777
 
5371
- # TODO: add SLAVEOF and all SENTINEL commands
5372
- def move(self, key: TEncodable, db_index: int) -> "Batch":
5373
- """
5374
- Move `key` from the currently selected database to the database specified by `db_index`.
5375
-
5376
- See [valkey.io](https://valkey.io/commands/move/) for more details.
5377
-
5378
- Args:
5379
- key (TEncodable): The key to move.
5380
- db_index (int): The index of the database to move `key` to.
5381
-
5382
- Commands response:
5383
- bool: True if `key` was moved.
5384
-
5385
- False if the `key` already exists in the destination database
5386
- or does not exist in the source database.
5387
- """
5388
- return self.append_command(RequestType.Move, [key, str(db_index)])
5389
-
5390
5778
  def select(self, index: int) -> "Batch":
5391
5779
  """
5392
5780
  Change the currently selected database.
@@ -5497,7 +5885,11 @@ class ClusterBatch(BaseBatch):
5497
5885
  self,
5498
5886
  source: TEncodable,
5499
5887
  destination: TEncodable,
5888
+ # TODO next major release the arguments replace and destinationDB must have their order
5889
+ # swapped to align with the standalone order.
5890
+ # At the moment of the patch release 2.1.1. we can't have a breaking change
5500
5891
  replace: Optional[bool] = None,
5892
+ destinationDB: Optional[int] = None,
5501
5893
  ) -> "ClusterBatch":
5502
5894
  """
5503
5895
  Copies the value stored at the `source` to the `destination` key. When `replace` is True,
@@ -5509,15 +5901,17 @@ class ClusterBatch(BaseBatch):
5509
5901
  source (TEncodable): The key to the source value.
5510
5902
  destination (TEncodable): The key where the value should be copied to.
5511
5903
  replace (Optional[bool]): If the destination key should be removed before copying the value to it.
5512
-
5904
+ destinationDB (Optional[int]): The alternative logical database index for the destination key.
5513
5905
  Command response:
5514
5906
  bool: True if the source was copied.
5515
5907
 
5516
5908
  Otherwise, return False.
5517
5909
 
5518
- Since: Valkey version 6.2.0.
5910
+ Since: Valkey version 9.0.0.
5519
5911
  """
5520
5912
  args = [source, destination]
5913
+ if destinationDB is not None:
5914
+ args.extend(["DB", str(destinationDB)])
5521
5915
  if replace is not None:
5522
5916
  args.append("REPLACE")
5523
5917
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  from typing import Optional
4
4
 
5
- from glide.constants import TSingleNodeRoute
5
+ from glide_shared.constants import TSingleNodeRoute
6
6
 
7
7
 
8
8
  class BatchRetryStrategy: