@valkey/valkey-glide 2.0.0-rc7 → 2.0.1
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.
- package/build-ts/BaseClient.d.ts +856 -367
- package/build-ts/BaseClient.js +856 -367
- package/package.json +9 -8
package/build-ts/BaseClient.d.ts
CHANGED
|
@@ -488,10 +488,13 @@ export declare class BaseClient {
|
|
|
488
488
|
* ```typescript
|
|
489
489
|
* // Example usage of get method to retrieve the value of a key
|
|
490
490
|
* const result = await client.get("key");
|
|
491
|
-
* console.log(result);
|
|
491
|
+
* console.log(result);
|
|
492
|
+
* // Output: 'value'
|
|
493
|
+
*
|
|
492
494
|
* // Example usage of get method to retrieve the value of a key with Bytes decoder
|
|
493
495
|
* const result = await client.get("key", { decoder: Decoder.Bytes });
|
|
494
|
-
* console.log(result);
|
|
496
|
+
* console.log(result);
|
|
497
|
+
* // Output: <Buffer 76 61 6c 75 65>
|
|
495
498
|
* ```
|
|
496
499
|
*/
|
|
497
500
|
get(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -512,7 +515,8 @@ export declare class BaseClient {
|
|
|
512
515
|
* @example
|
|
513
516
|
* ```typescript
|
|
514
517
|
* const result = await client.getex("key", {expiry: { type: TimeUnit.Seconds, count: 5 }});
|
|
515
|
-
* console.log(result);
|
|
518
|
+
* console.log(result);
|
|
519
|
+
* // Output: 'value'
|
|
516
520
|
* ```
|
|
517
521
|
*/
|
|
518
522
|
getex(key: GlideString, options?: {
|
|
@@ -533,7 +537,8 @@ export declare class BaseClient {
|
|
|
533
537
|
* @example
|
|
534
538
|
* ```typescript
|
|
535
539
|
* const result = client.getdel("key");
|
|
536
|
-
* console.log(result);
|
|
540
|
+
* console.log(result);
|
|
541
|
+
* // Output: 'value'
|
|
537
542
|
*
|
|
538
543
|
* const value = client.getdel("key"); // value is null
|
|
539
544
|
* ```
|
|
@@ -558,13 +563,21 @@ export declare class BaseClient {
|
|
|
558
563
|
* ```typescript
|
|
559
564
|
* await client.set("mykey", "This is a string")
|
|
560
565
|
* let result = await client.getrange("mykey", 0, 3)
|
|
561
|
-
* console.log(result);
|
|
566
|
+
* console.log(result);
|
|
567
|
+
* // Output: "This"
|
|
568
|
+
*
|
|
562
569
|
* result = await client.getrange("mykey", -3, -1)
|
|
563
|
-
* console.log(result);
|
|
570
|
+
* console.log(result);
|
|
571
|
+
* // Output: "ing"
|
|
572
|
+
* // extracted last 3 characters of a string
|
|
573
|
+
*
|
|
564
574
|
* result = await client.getrange("mykey", 0, 100)
|
|
565
|
-
* console.log(result);
|
|
575
|
+
* console.log(result);
|
|
576
|
+
* // Output: "This is a string"
|
|
577
|
+
*
|
|
566
578
|
* result = await client.getrange("mykey", 5, 6)
|
|
567
|
-
* console.log(result);
|
|
579
|
+
* console.log(result);
|
|
580
|
+
* // Output: ""
|
|
568
581
|
* ```
|
|
569
582
|
*/
|
|
570
583
|
getrange(key: GlideString, start: number, end: number, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -588,22 +601,33 @@ export declare class BaseClient {
|
|
|
588
601
|
*
|
|
589
602
|
* // Example usage of set method with conditional options and expiration
|
|
590
603
|
* const result2 = await client.set("key", "new_value", {conditionalSet: "onlyIfExists", expiry: { type: TimeUnit.Seconds, count: 5 }});
|
|
591
|
-
* console.log(result2);
|
|
604
|
+
* console.log(result2);
|
|
605
|
+
* // Output: 'OK'
|
|
606
|
+
* // Set "new_value" to `key" only if `key` already exists, and set the key expiration to 5 seconds.
|
|
592
607
|
*
|
|
593
608
|
* // Example usage of set method with conditional options and returning old value
|
|
594
609
|
* const result3 = await client.set("key", "value", {conditionalSet: "onlyIfDoesNotExist", returnOldValue: true});
|
|
595
|
-
* console.log(result3);
|
|
610
|
+
* console.log(result3);
|
|
611
|
+
* // Output: 'new_value'
|
|
612
|
+
* // Returns the old value of `key`.
|
|
596
613
|
*
|
|
597
614
|
* // Example usage of get method to retrieve the value of a key
|
|
598
615
|
* const result4 = await client.get("key");
|
|
599
|
-
* console.log(result4);
|
|
616
|
+
* console.log(result4);
|
|
617
|
+
* // Output: 'new_value'
|
|
618
|
+
* // Value wasn't modified back to being "value" because of "NX" flag.
|
|
600
619
|
*
|
|
601
620
|
* // Example usage of set method with conditional option IFEQ
|
|
602
621
|
* await client.set("key", "value we will compare to");
|
|
603
622
|
* const result5 = await client.set("key", "new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
|
|
604
|
-
* console.log(result5);
|
|
623
|
+
* console.log(result5);
|
|
624
|
+
* // Output: 'OK'
|
|
625
|
+
* // Set "new_value" to "key" only if comparisonValue is equal to the current value of "key".
|
|
626
|
+
*
|
|
605
627
|
* const result6 = await client.set("key", "another_new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
|
|
606
|
-
* console.log(result6);
|
|
628
|
+
* console.log(result6);
|
|
629
|
+
* // Output: null
|
|
630
|
+
* // Value wasn't set because the comparisonValue is not equal to the current value of `key`. Value of `key` remains "new_value".
|
|
607
631
|
* ```
|
|
608
632
|
*/
|
|
609
633
|
set(key: GlideString, value: GlideString, options?: SetOptions & DecoderOption): Promise<"OK" | GlideString | null>;
|
|
@@ -650,13 +674,15 @@ export declare class BaseClient {
|
|
|
650
674
|
* @example
|
|
651
675
|
* ```typescript
|
|
652
676
|
* let result = await client.dump("myKey");
|
|
653
|
-
* console.log(result);
|
|
677
|
+
* console.log(result);
|
|
678
|
+
* // Result contains the serialized value of `myKey`
|
|
654
679
|
* ```
|
|
655
680
|
*
|
|
656
681
|
* @example
|
|
657
682
|
* ```typescript
|
|
658
683
|
* result = await client.dump("nonExistingKey");
|
|
659
|
-
* console.log(result);
|
|
684
|
+
* console.log(result);
|
|
685
|
+
* // Output: null
|
|
660
686
|
* ```
|
|
661
687
|
*/
|
|
662
688
|
dump(key: GlideString): Promise<Buffer | null>;
|
|
@@ -721,7 +747,8 @@ export declare class BaseClient {
|
|
|
721
747
|
* await client.set("key1", "value1");
|
|
722
748
|
* await client.set("key2", "value2");
|
|
723
749
|
* const result = await client.mget(["key1", "key2"]);
|
|
724
|
-
* console.log(result);
|
|
750
|
+
* console.log(result);
|
|
751
|
+
* // Output: ['value1', 'value2']
|
|
725
752
|
* ```
|
|
726
753
|
*/
|
|
727
754
|
mget(keys: GlideString[], options?: DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -878,10 +905,14 @@ export declare class BaseClient {
|
|
|
878
905
|
* await client.set("key1", "A"); // "A" has binary value 01000001
|
|
879
906
|
* await client.set("key2", "B"); // "B" has binary value 01000010
|
|
880
907
|
* const result1 = await client.bitop(BitwiseOperation.AND, "destination", ["key1", "key2"]);
|
|
881
|
-
* console.log(result1);
|
|
908
|
+
* console.log(result1);
|
|
909
|
+
* // Output: 1
|
|
910
|
+
* // The size of the resulting string stored in "destination" is 1.
|
|
882
911
|
*
|
|
883
912
|
* const result2 = await client.get("destination");
|
|
884
|
-
* console.log(result2);
|
|
913
|
+
* console.log(result2);
|
|
914
|
+
* // Output: "@"
|
|
915
|
+
* // "@" has binary value 01000000
|
|
885
916
|
* ```
|
|
886
917
|
*/
|
|
887
918
|
bitop(operation: BitwiseOperation, destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -899,7 +930,9 @@ export declare class BaseClient {
|
|
|
899
930
|
* @example
|
|
900
931
|
* ```typescript
|
|
901
932
|
* const result = await client.getbit("key", 1);
|
|
902
|
-
* console.log(result);
|
|
933
|
+
* console.log(result);
|
|
934
|
+
* // Output: 1
|
|
935
|
+
* // The second bit of the string stored at `key` is set to 1.
|
|
903
936
|
* ```
|
|
904
937
|
*/
|
|
905
938
|
getbit(key: GlideString, offset: number): Promise<number>;
|
|
@@ -919,7 +952,9 @@ export declare class BaseClient {
|
|
|
919
952
|
* @example
|
|
920
953
|
* ```typescript
|
|
921
954
|
* const result = await client.setbit("key", 1, 1);
|
|
922
|
-
* console.log(result);
|
|
955
|
+
* console.log(result);
|
|
956
|
+
* // Output: 0
|
|
957
|
+
* // The second bit value was 0 before setting to 1.
|
|
923
958
|
* ```
|
|
924
959
|
*/
|
|
925
960
|
setbit(key: GlideString, offset: number, value: number): Promise<number>;
|
|
@@ -942,17 +977,25 @@ export declare class BaseClient {
|
|
|
942
977
|
* ```typescript
|
|
943
978
|
* await client.set("key1", "A1"); // "A1" has binary value 01000001 00110001
|
|
944
979
|
* const result1 = await client.bitpos("key1", 1);
|
|
945
|
-
* console.log(result1);
|
|
980
|
+
* console.log(result1);
|
|
981
|
+
* // Output: 1
|
|
982
|
+
* // The first occurrence of bit value 1 in the string stored at `key1` is at the second position.
|
|
946
983
|
*
|
|
947
984
|
* const result2 = await client.bitpos("key1", 1, { start: -1 });
|
|
948
|
-
* console.log(result2);
|
|
985
|
+
* console.log(result2);
|
|
986
|
+
* // Output: 10
|
|
987
|
+
* // The first occurrence of bit value 1, starting at the last byte in the string stored at `key1`, is at the eleventh position.
|
|
949
988
|
*
|
|
950
989
|
* await client.set("key1", "A12"); // "A12" has binary value 01000001 00110001 00110010
|
|
951
990
|
* const result3 = await client.bitpos("key1", 1, { start: 1, end: -1 });
|
|
952
|
-
* console.log(result3);
|
|
991
|
+
* console.log(result3);
|
|
992
|
+
* // Output: 10
|
|
993
|
+
* // The first occurrence of bit value 1 in the second byte to the last byte of the string stored at `key1` is at the eleventh position.
|
|
953
994
|
*
|
|
954
995
|
* const result4 = await client.bitpos("key1", 1, { start: 2, end: 9, indexType: BitmapIndexType.BIT });
|
|
955
|
-
* console.log(result4);
|
|
996
|
+
* console.log(result4);
|
|
997
|
+
* // Output: 7
|
|
998
|
+
* // The first occurrence of bit value 1 in the third to tenth bits of the string stored at `key1` is at the eighth position.
|
|
956
999
|
* ```
|
|
957
1000
|
*/
|
|
958
1001
|
bitpos(key: GlideString, bit: number, options?: BitOffsetOptions): Promise<number>;
|
|
@@ -984,7 +1027,9 @@ export declare class BaseClient {
|
|
|
984
1027
|
* ```typescript
|
|
985
1028
|
* await client.set("key", "A"); // "A" has binary value 01000001
|
|
986
1029
|
* const result = await client.bitfield("key", [new BitFieldSet(new UnsignedEncoding(2), new BitOffset(1), 3), new BitFieldGet(new UnsignedEncoding(2), new BitOffset(1))]);
|
|
987
|
-
* console.log(result);
|
|
1030
|
+
* console.log(result);
|
|
1031
|
+
* // Output: [2, 3]
|
|
1032
|
+
* // The old value at offset 1 with an unsigned encoding of 2 was 2. The new value at offset 1 with an unsigned encoding of 2 is 3.
|
|
988
1033
|
* ```
|
|
989
1034
|
*/
|
|
990
1035
|
bitfield(key: GlideString, subcommands: BitFieldSubCommands[]): Promise<(number | null)[]>;
|
|
@@ -1002,7 +1047,9 @@ export declare class BaseClient {
|
|
|
1002
1047
|
* ```typescript
|
|
1003
1048
|
* await client.set("key", "A"); // "A" has binary value 01000001
|
|
1004
1049
|
* const result = await client.bitfieldReadOnly("key", [new BitFieldGet(new UnsignedEncoding(2), new BitOffset(1))]);
|
|
1005
|
-
* console.log(result);
|
|
1050
|
+
* console.log(result);
|
|
1051
|
+
* // Output: [2]
|
|
1052
|
+
* // The value at offset 1 with an unsigned encoding of 2 is 2.
|
|
1006
1053
|
* ```
|
|
1007
1054
|
*/
|
|
1008
1055
|
bitfieldReadOnly(key: GlideString, subcommands: BitFieldGet[]): Promise<number[]>;
|
|
@@ -1020,14 +1067,18 @@ export declare class BaseClient {
|
|
|
1020
1067
|
* // Example usage of the hget method on an-existing field
|
|
1021
1068
|
* await client.hset("my_hash", {"field": "value"});
|
|
1022
1069
|
* const result = await client.hget("my_hash", "field");
|
|
1023
|
-
* console.log(result);
|
|
1070
|
+
* console.log(result);
|
|
1071
|
+
* // Output: "value"
|
|
1072
|
+
* // The value associated with `field` in the key `my_hash`.
|
|
1024
1073
|
* ```
|
|
1025
1074
|
*
|
|
1026
1075
|
* @example
|
|
1027
1076
|
* ```typescript
|
|
1028
1077
|
* // Example usage of the hget method on a non-existing field
|
|
1029
1078
|
* const result = await client.hget("my_hash", "nonexistent_field");
|
|
1030
|
-
* console.log(result);
|
|
1079
|
+
* console.log(result);
|
|
1080
|
+
* // Output: null
|
|
1081
|
+
* // Indicates non existent key.
|
|
1031
1082
|
* ```
|
|
1032
1083
|
*/
|
|
1033
1084
|
hget(key: GlideString, field: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1043,11 +1094,15 @@ export declare class BaseClient {
|
|
|
1043
1094
|
* ```typescript
|
|
1044
1095
|
* // Example usage of the hset method using HashDataType as input type
|
|
1045
1096
|
* const result = await client.hset("my_hash", [{"field": "field1", "value": "value1"}, {"field": "field2", "value": "value2"}]);
|
|
1046
|
-
* console.log(result);
|
|
1097
|
+
* console.log(result);
|
|
1098
|
+
* // Output: 2
|
|
1099
|
+
* // Indicates that 2 fields were successfully set in the hash `my_hash`.
|
|
1047
1100
|
*
|
|
1048
1101
|
* // Example usage of the hset method using Record<string, GlideString> as input
|
|
1049
1102
|
* const result = await client.hset("my_hash", {"field1": "value", "field2": "value2"});
|
|
1050
|
-
* console.log(result);
|
|
1103
|
+
* console.log(result);
|
|
1104
|
+
* // Output: 2
|
|
1105
|
+
* // Indicates that 2 fields were successfully set in the hash `my_hash`.
|
|
1051
1106
|
* ```
|
|
1052
1107
|
*/
|
|
1053
1108
|
hset(key: GlideString, fieldsAndValues: HashDataType | Record<string, GlideString>): Promise<number>;
|
|
@@ -1065,7 +1120,9 @@ export declare class BaseClient {
|
|
|
1065
1120
|
* // Example usage of the hkeys method:
|
|
1066
1121
|
* await client.hset("my_hash", {"field1": "value1", "field2": "value2", "field3": "value3"});
|
|
1067
1122
|
* const result = await client.hkeys("my_hash");
|
|
1068
|
-
* console.log(result);
|
|
1123
|
+
* console.log(result);
|
|
1124
|
+
* // Output: ["field1", "field2", "field3"]
|
|
1125
|
+
* // Returns all the field names stored in the hash `my_hash`.
|
|
1069
1126
|
* ```
|
|
1070
1127
|
*/
|
|
1071
1128
|
hkeys(key: GlideString, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1084,14 +1141,18 @@ export declare class BaseClient {
|
|
|
1084
1141
|
* ```typescript
|
|
1085
1142
|
* // Example usage of the hsetnx method
|
|
1086
1143
|
* const result = await client.hsetnx("my_hash", "field", "value");
|
|
1087
|
-
* console.log(result);
|
|
1144
|
+
* console.log(result);
|
|
1145
|
+
* // Output: true
|
|
1146
|
+
* // Indicates that the field "field" was set successfully in the hash `my_hash`.
|
|
1088
1147
|
* ```
|
|
1089
1148
|
*
|
|
1090
1149
|
* @example
|
|
1091
1150
|
* ```typescript
|
|
1092
1151
|
* // Example usage of the hsetnx method on a field that already exists
|
|
1093
1152
|
* const result = await client.hsetnx("my_hash", "field", "new_value");
|
|
1094
|
-
* console.log(result);
|
|
1153
|
+
* console.log(result);
|
|
1154
|
+
* // Output: false
|
|
1155
|
+
* // Indicates that the field `field` already existed in the hash `my_hash` and was not set again.
|
|
1095
1156
|
* ```
|
|
1096
1157
|
*/
|
|
1097
1158
|
hsetnx(key: GlideString, field: GlideString, value: GlideString): Promise<boolean>;
|
|
@@ -1109,7 +1170,9 @@ export declare class BaseClient {
|
|
|
1109
1170
|
* ```typescript
|
|
1110
1171
|
* // Example usage of the hdel method
|
|
1111
1172
|
* const result = await client.hdel("my_hash", ["field1", "field2"]);
|
|
1112
|
-
* console.log(result);
|
|
1173
|
+
* console.log(result);
|
|
1174
|
+
* // Output: 2
|
|
1175
|
+
* // Indicates that two fields were successfully removed from the hash.
|
|
1113
1176
|
* ```
|
|
1114
1177
|
*/
|
|
1115
1178
|
hdel(key: GlideString, fields: GlideString[]): Promise<number>;
|
|
@@ -1128,7 +1191,9 @@ export declare class BaseClient {
|
|
|
1128
1191
|
* ```typescript
|
|
1129
1192
|
* // Example usage of the hmget method
|
|
1130
1193
|
* const result = await client.hmget("my_hash", ["field1", "field2"]);
|
|
1131
|
-
* console.log(result);
|
|
1194
|
+
* console.log(result);
|
|
1195
|
+
* // Output: ["value1", "value2"]
|
|
1196
|
+
* // A list of values associated with the specified fields.
|
|
1132
1197
|
* ```
|
|
1133
1198
|
*/
|
|
1134
1199
|
hmget(key: GlideString, fields: GlideString[], options?: DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -1144,14 +1209,18 @@ export declare class BaseClient {
|
|
|
1144
1209
|
* ```typescript
|
|
1145
1210
|
* // Example usage of the hexists method with existing field
|
|
1146
1211
|
* const result = await client.hexists("my_hash", "field1");
|
|
1147
|
-
* console.log(result);
|
|
1212
|
+
* console.log(result);
|
|
1213
|
+
* // Output: true
|
|
1214
|
+
* // Returns true because `my_hash` hash contains `field1` field.
|
|
1148
1215
|
* ```
|
|
1149
1216
|
*
|
|
1150
1217
|
* @example
|
|
1151
1218
|
* ```typescript
|
|
1152
1219
|
* // Example usage of the hexists method with non-existing field
|
|
1153
1220
|
* const result = await client.hexists("my_hash", "nonexistent_field");
|
|
1154
|
-
* console.log(result);
|
|
1221
|
+
* console.log(result);
|
|
1222
|
+
* // Output: false
|
|
1223
|
+
* // Returns false because `my_hash` hash does not contain `nonexistent_field` field.
|
|
1155
1224
|
* ```
|
|
1156
1225
|
*/
|
|
1157
1226
|
hexists(key: GlideString, field: GlideString): Promise<boolean>;
|
|
@@ -1169,7 +1238,8 @@ export declare class BaseClient {
|
|
|
1169
1238
|
* ```typescript
|
|
1170
1239
|
* // Example usage of the hgetall method
|
|
1171
1240
|
* const result = await client.hgetall("my_hash");
|
|
1172
|
-
* console.log(result);
|
|
1241
|
+
* console.log(result);
|
|
1242
|
+
* // Output: all fields and values stored at `my_hash`
|
|
1173
1243
|
* // [
|
|
1174
1244
|
* // { field: "field1", value: "value1"},
|
|
1175
1245
|
* // { field: "field2", value: "value2"}
|
|
@@ -1192,7 +1262,9 @@ export declare class BaseClient {
|
|
|
1192
1262
|
* ```typescript
|
|
1193
1263
|
* // Example usage of the hincrby method to increment the value in a hash by a specified amount
|
|
1194
1264
|
* const result = await client.hincrby("my_hash", "field1", 5);
|
|
1195
|
-
* console.log(result);
|
|
1265
|
+
* console.log(result);
|
|
1266
|
+
* // Output: 5
|
|
1267
|
+
* // Increments the value stored at hash field `field1` by 5
|
|
1196
1268
|
* ```
|
|
1197
1269
|
*/
|
|
1198
1270
|
hincrBy(key: GlideString, field: GlideString, amount: number): Promise<number>;
|
|
@@ -1211,7 +1283,9 @@ export declare class BaseClient {
|
|
|
1211
1283
|
* ```typescript
|
|
1212
1284
|
* // Example usage of the hincrbyfloat method to increment the value of a floating point in a hash by a specified amount
|
|
1213
1285
|
* const result = await client.hincrbyfloat("my_hash", "field1", 2.5);
|
|
1214
|
-
* console.log(result);
|
|
1286
|
+
* console.log(result);
|
|
1287
|
+
* // Output: 2.5
|
|
1288
|
+
* // Increments the value stored at hash field `field1` by 2.5
|
|
1215
1289
|
* ```
|
|
1216
1290
|
*/
|
|
1217
1291
|
hincrByFloat(key: GlideString, field: GlideString, amount: number): Promise<number>;
|
|
@@ -1226,14 +1300,18 @@ export declare class BaseClient {
|
|
|
1226
1300
|
* ```typescript
|
|
1227
1301
|
* // Example usage of the hlen method with an existing key
|
|
1228
1302
|
* const result = await client.hlen("my_hash");
|
|
1229
|
-
* console.log(result);
|
|
1303
|
+
* console.log(result);
|
|
1304
|
+
* // Output: 3
|
|
1305
|
+
* // Returns the number of fields for the hash stored at key `my_hash`.
|
|
1230
1306
|
* ```
|
|
1231
1307
|
*
|
|
1232
1308
|
* @example
|
|
1233
1309
|
* ```typescript
|
|
1234
1310
|
* // Example usage of the hlen method with a non-existing key
|
|
1235
1311
|
* const result = await client.hlen("non_existing_key");
|
|
1236
|
-
* console.log(result);
|
|
1312
|
+
* console.log(result);
|
|
1313
|
+
* // Output: 0
|
|
1314
|
+
* // Returns 0 for non-existent key.
|
|
1237
1315
|
* ```
|
|
1238
1316
|
*/
|
|
1239
1317
|
hlen(key: GlideString): Promise<number>;
|
|
@@ -1249,7 +1327,9 @@ export declare class BaseClient {
|
|
|
1249
1327
|
* ```typescript
|
|
1250
1328
|
* // Example usage of the hvals method
|
|
1251
1329
|
* const result = await client.hvals("my_hash");
|
|
1252
|
-
* console.log(result);
|
|
1330
|
+
* console.log(result);
|
|
1331
|
+
* // Output: ["value1", "value2", "value3"]
|
|
1332
|
+
* // Returns all the values stored in the hash `my_hash`.
|
|
1253
1333
|
* ```
|
|
1254
1334
|
*/
|
|
1255
1335
|
hvals(key: GlideString, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1266,7 +1346,9 @@ export declare class BaseClient {
|
|
|
1266
1346
|
* ```typescript
|
|
1267
1347
|
* await client.hset("my_hash", {"field": "value"});
|
|
1268
1348
|
* const result = await client.hstrlen("my_hash", "field");
|
|
1269
|
-
* console.log(result);
|
|
1349
|
+
* console.log(result);
|
|
1350
|
+
* // Output: 5
|
|
1351
|
+
* // Returns the string length of `value` which is the value associated with the field `field` stored at key `my_hash`.
|
|
1270
1352
|
* ```
|
|
1271
1353
|
*/
|
|
1272
1354
|
hstrlen(key: GlideString, field: GlideString): Promise<number>;
|
|
@@ -1283,7 +1365,10 @@ export declare class BaseClient {
|
|
|
1283
1365
|
*
|
|
1284
1366
|
* @example
|
|
1285
1367
|
* ```typescript
|
|
1286
|
-
*
|
|
1368
|
+
* const result = await client.hrandfield("myHash")
|
|
1369
|
+
* console.log(result);
|
|
1370
|
+
* // Output: 'field'
|
|
1371
|
+
* // Returns a random field stored at the key `my_hash`.
|
|
1287
1372
|
* ```
|
|
1288
1373
|
*/
|
|
1289
1374
|
hrandfield(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1317,12 +1402,13 @@ export declare class BaseClient {
|
|
|
1317
1402
|
* console.log("Members: ", result[1]);
|
|
1318
1403
|
* } while (newCursor !== "0");
|
|
1319
1404
|
* // The output of the code above is something similar to:
|
|
1320
|
-
* // Cursor: 31
|
|
1321
|
-
* // Members: ['field 79', 'value 79', 'field 20', 'value 20', 'field 115', 'value 115']
|
|
1322
|
-
* // Cursor: 39
|
|
1323
|
-
* // Members: ['field 63', 'value 63', 'field 293', 'value 293', 'field 162', 'value 162']
|
|
1324
|
-
* // Cursor: 0
|
|
1405
|
+
* // Cursor: 31 // The cursor after the first interation.
|
|
1406
|
+
* // Members: ['field 79', 'value 79', 'field 20', 'value 20', 'field 115', 'value 115'] // First 3 hash field-value pairs stored at the key `key1`
|
|
1407
|
+
* // Cursor: 39 // The cursor after the second interation.
|
|
1408
|
+
* // Members: ['field 63', 'value 63', 'field 293', 'value 293', 'field 162', 'value 162'] // The next 3 hash field-value pairs at key `key1`
|
|
1409
|
+
* // Cursor: 0 // The cursor after the last batch of elements is fetched.
|
|
1325
1410
|
* // Members: ['field 55', 'value 55', 'field 24', 'value 24', 'field 90', 'value 90', 'field 113', 'value 113']
|
|
1411
|
+
* // You can get more than `count` elements in the result set. Read the count documentation for more information.
|
|
1326
1412
|
* ```
|
|
1327
1413
|
* @example
|
|
1328
1414
|
* ```typescript
|
|
@@ -1340,12 +1426,13 @@ export declare class BaseClient {
|
|
|
1340
1426
|
* console.log("Members: ", result[1]);
|
|
1341
1427
|
* } while (newCursor !== "0");
|
|
1342
1428
|
* // The output of the code above is something similar to:
|
|
1343
|
-
* // Cursor: 31
|
|
1344
|
-
* // Members: ['field 79', 'field 20', 'field 115']
|
|
1345
|
-
* // Cursor: 39
|
|
1346
|
-
* // Members: ['field 63', 'field 293', 'field 162']
|
|
1347
|
-
* // Cursor: 0
|
|
1429
|
+
* // Cursor: 31 // The cursor after the first interation.
|
|
1430
|
+
* // Members: ['field 79', 'field 20', 'field 115'] // First 3 hash fields stored at the key `key1`
|
|
1431
|
+
* // Cursor: 39 // The cursor after the second interation.
|
|
1432
|
+
* // Members: ['field 63', 'field 293', 'field 162'] // Next 3 hash fields stored at the key `key1`
|
|
1433
|
+
* // Cursor: 0 // The cursor after the last batch of elements is fetched.
|
|
1348
1434
|
* // Members: ['field 55', 'field 24', 'field 90', 'field 113']
|
|
1435
|
+
* // You can get more than `count` elements in the result set. Read the count documentation for more information.
|
|
1349
1436
|
* ```
|
|
1350
1437
|
*/
|
|
1351
1438
|
hscan(key: GlideString, cursor: string, options?: HScanOptions & DecoderOption): Promise<[string, GlideString[]]>;
|
|
@@ -1365,7 +1452,10 @@ export declare class BaseClient {
|
|
|
1365
1452
|
*
|
|
1366
1453
|
* @example
|
|
1367
1454
|
* ```typescript
|
|
1368
|
-
*
|
|
1455
|
+
* result = await client.hrandfieldCount("my_hash", 2)
|
|
1456
|
+
* console.log(result);
|
|
1457
|
+
* // Output: ['field1', 'field2']
|
|
1458
|
+
* // Returns 2 random fields from the hash stored at key `my_hash`.
|
|
1369
1459
|
* ```
|
|
1370
1460
|
*/
|
|
1371
1461
|
hrandfieldCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1388,7 +1478,9 @@ export declare class BaseClient {
|
|
|
1388
1478
|
* @example
|
|
1389
1479
|
* ```typescript
|
|
1390
1480
|
* const result = await client.hrandfieldCountWithValues("myHash", 2);
|
|
1391
|
-
* console.log(result);
|
|
1481
|
+
* console.log(result);
|
|
1482
|
+
* // Output: [['field1', 'value1'], ['field2', 'value2']]
|
|
1483
|
+
* // Returns 2 random field-value pairs from the hash stored at key `my_hash`.
|
|
1392
1484
|
* ```
|
|
1393
1485
|
*/
|
|
1394
1486
|
hrandfieldWithValues(key: GlideString, count: number, options?: DecoderOption): Promise<[GlideString, GlideString][]>;
|
|
@@ -1406,14 +1498,18 @@ export declare class BaseClient {
|
|
|
1406
1498
|
* ```typescript
|
|
1407
1499
|
* // Example usage of the lpush method with an existing list
|
|
1408
1500
|
* const result = await client.lpush("my_list", ["value2", "value3"]);
|
|
1409
|
-
* console.log(result);
|
|
1501
|
+
* console.log(result);
|
|
1502
|
+
* // Output: 3
|
|
1503
|
+
* // Indicates that the new length of the list is 3 after the push operation.
|
|
1410
1504
|
* ```
|
|
1411
1505
|
*
|
|
1412
1506
|
* @example
|
|
1413
1507
|
* ```typescript
|
|
1414
1508
|
* // Example usage of the lpush method with a non-existing list
|
|
1415
1509
|
* const result = await client.lpush("nonexistent_list", ["new_value"]);
|
|
1416
|
-
* console.log(result);
|
|
1510
|
+
* console.log(result);
|
|
1511
|
+
* // Output: 1
|
|
1512
|
+
* // Indicates that a new list was created with one element
|
|
1417
1513
|
* ```
|
|
1418
1514
|
*/
|
|
1419
1515
|
lpush(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1428,8 +1524,10 @@ export declare class BaseClient {
|
|
|
1428
1524
|
* @returns The length of the list after the push operation.
|
|
1429
1525
|
* @example
|
|
1430
1526
|
* ```typescript
|
|
1431
|
-
* const
|
|
1432
|
-
* console.log(result);
|
|
1527
|
+
* const result = await client.lpushx("my_list", ["value1", "value2"]);
|
|
1528
|
+
* console.log(result);
|
|
1529
|
+
* // Output: 2
|
|
1530
|
+
* // Indicates that the list has two elements after the push operation.
|
|
1433
1531
|
* ```
|
|
1434
1532
|
*/
|
|
1435
1533
|
lpushx(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1447,14 +1545,18 @@ export declare class BaseClient {
|
|
|
1447
1545
|
* ```typescript
|
|
1448
1546
|
* // Example usage of the lpop method with an existing list
|
|
1449
1547
|
* const result = await client.lpop("my_list");
|
|
1450
|
-
* console.log(result);
|
|
1548
|
+
* console.log(result);
|
|
1549
|
+
* // Output: 'value1'
|
|
1550
|
+
* // Returns and removes the first element of the list `value1`.
|
|
1451
1551
|
* ```
|
|
1452
1552
|
*
|
|
1453
1553
|
* @example
|
|
1454
1554
|
* ```typescript
|
|
1455
1555
|
* // Example usage of the lpop method with a non-existing list
|
|
1456
1556
|
* const result = await client.lpop("non_exiting_key");
|
|
1457
|
-
* console.log(result);
|
|
1557
|
+
* console.log(result);
|
|
1558
|
+
* // Output: null
|
|
1559
|
+
* // Returns null for non-existent key.
|
|
1458
1560
|
* ```
|
|
1459
1561
|
*/
|
|
1460
1562
|
lpop(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1472,14 +1574,18 @@ export declare class BaseClient {
|
|
|
1472
1574
|
* ```typescript
|
|
1473
1575
|
* // Example usage of the lpopCount method with an existing list
|
|
1474
1576
|
* const result = await client.lpopCount("my_list", 2);
|
|
1475
|
-
* console.log(result);
|
|
1577
|
+
* console.log(result);
|
|
1578
|
+
* // Output: ["value1", "value2"]
|
|
1579
|
+
* // Returns and removes 2 elements from the list.
|
|
1476
1580
|
* ```
|
|
1477
1581
|
*
|
|
1478
1582
|
* @example
|
|
1479
1583
|
* ```typescript
|
|
1480
1584
|
* // Example usage of the lpopCount method with a non-existing list
|
|
1481
1585
|
* const result = await client.lpopCount("non_exiting_key", 3);
|
|
1482
|
-
* console.log(result);
|
|
1586
|
+
* console.log(result);
|
|
1587
|
+
* // Output: null
|
|
1588
|
+
* // Returns null in case of non-existent key.
|
|
1483
1589
|
* ```
|
|
1484
1590
|
*/
|
|
1485
1591
|
lpopCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[] | null>;
|
|
@@ -1503,21 +1609,27 @@ export declare class BaseClient {
|
|
|
1503
1609
|
* ```typescript
|
|
1504
1610
|
* // Example usage of the lrange method with an existing list and positive indices
|
|
1505
1611
|
* const result = await client.lrange("my_list", 0, 2);
|
|
1506
|
-
* console.log(result);
|
|
1612
|
+
* console.log(result);
|
|
1613
|
+
* // Output: ["value1", "value2", "value3"]
|
|
1614
|
+
* // Returns the first 3 elements of the list.
|
|
1507
1615
|
* ```
|
|
1508
1616
|
*
|
|
1509
1617
|
* @example
|
|
1510
1618
|
* ```typescript
|
|
1511
1619
|
* // Example usage of the lrange method with an existing list and negative indices
|
|
1512
1620
|
* const result = await client.lrange("my_list", -2, -1);
|
|
1513
|
-
* console.log(result);
|
|
1621
|
+
* console.log(result);
|
|
1622
|
+
* // Output: ["value2", "value3"]
|
|
1623
|
+
* // Returns the last 2 elements of the list.
|
|
1514
1624
|
* ```
|
|
1515
1625
|
*
|
|
1516
1626
|
* @example
|
|
1517
1627
|
* ```typescript
|
|
1518
1628
|
* // Example usage of the lrange method with a non-existing list
|
|
1519
1629
|
* const result = await client.lrange("non_exiting_key", 0, 2);
|
|
1520
|
-
* console.log(result);
|
|
1630
|
+
* console.log(result);
|
|
1631
|
+
* // Output: []
|
|
1632
|
+
* // Returns an empty list for non-existent key.
|
|
1521
1633
|
* ```
|
|
1522
1634
|
*/
|
|
1523
1635
|
lrange(key: GlideString, start: number, end: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1533,7 +1645,9 @@ export declare class BaseClient {
|
|
|
1533
1645
|
* ```typescript
|
|
1534
1646
|
* // Example usage of the llen method
|
|
1535
1647
|
* const result = await client.llen("my_list");
|
|
1536
|
-
* console.log(result);
|
|
1648
|
+
* console.log(result);
|
|
1649
|
+
* // Output: 3
|
|
1650
|
+
* // Indicates that there are 3 elements in the list.
|
|
1537
1651
|
* ```
|
|
1538
1652
|
*/
|
|
1539
1653
|
llen(key: GlideString): Promise<number>;
|
|
@@ -1554,17 +1668,23 @@ export declare class BaseClient {
|
|
|
1554
1668
|
*
|
|
1555
1669
|
* @example
|
|
1556
1670
|
* ```typescript
|
|
1557
|
-
* await client.lpush("testKey1", ["two", "one"]);
|
|
1558
|
-
* await client.lpush("testKey2", ["four", "three"]);
|
|
1671
|
+
* await client.lpush("testKey1", ["two", "one"]); // The key `testKey1` has a list ["one", "two"] after this operation.
|
|
1672
|
+
* await client.lpush("testKey2", ["four", "three"]); // The key `testKey2` has a list ["three", "four"] after this operation.
|
|
1559
1673
|
*
|
|
1560
|
-
* const
|
|
1561
|
-
* console.log(
|
|
1674
|
+
* const result = await client.lmove("testKey1", "testKey2", ListDirection.LEFT, ListDirection.LEFT);
|
|
1675
|
+
* console.log(result);
|
|
1676
|
+
* // Output: "one".
|
|
1677
|
+
* // Removes "one" from the list at key `testKey1` and adds it to the left of the list at `testKey2`.
|
|
1562
1678
|
*
|
|
1563
1679
|
* const updated_array_key1 = await client.lrange("testKey1", 0, -1);
|
|
1564
|
-
* console.log(
|
|
1680
|
+
* console.log(updated_array_key1);
|
|
1681
|
+
* // Output: ["two"]
|
|
1682
|
+
* // The elements in the list at `testKey1` after lmove command.
|
|
1565
1683
|
*
|
|
1566
1684
|
* const updated_array_key2 = await client.lrange("testKey2", 0, -1);
|
|
1567
|
-
* console.log(updated_array_key2);
|
|
1685
|
+
* console.log(updated_array_key2);
|
|
1686
|
+
* // Output: ["one", "three", "four"]
|
|
1687
|
+
* // The elements in the list at `testKey2` after lmove command.
|
|
1568
1688
|
* ```
|
|
1569
1689
|
*/
|
|
1570
1690
|
lmove(source: GlideString, destination: GlideString, whereFrom: ListDirection, whereTo: ListDirection, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1589,16 +1709,22 @@ export declare class BaseClient {
|
|
|
1589
1709
|
*
|
|
1590
1710
|
* @example
|
|
1591
1711
|
* ```typescript
|
|
1592
|
-
* await client.lpush("testKey1", ["two", "one"]);
|
|
1593
|
-
* await client.lpush("testKey2", ["four", "three"]);
|
|
1712
|
+
* await client.lpush("testKey1", ["two", "one"]); // The key `testKey1` has a list ["one", "two"] after this operation.
|
|
1713
|
+
* await client.lpush("testKey2", ["four", "three"]); // The key `testKey2` has a list ["three", "four"] after this operation.
|
|
1594
1714
|
* const result = await client.blmove("testKey1", "testKey2", ListDirection.LEFT, ListDirection.LEFT, 0.1);
|
|
1595
|
-
* console.log(result);
|
|
1715
|
+
* console.log(result);
|
|
1716
|
+
* // Output: "one"
|
|
1717
|
+
* // Removes "one" from the list at key `testKey1` and adds it to the left of the list at `testKey2`.
|
|
1596
1718
|
*
|
|
1597
|
-
* const
|
|
1598
|
-
* console.log(
|
|
1719
|
+
* const updated_array1 = await client.lrange("testKey1", 0, -1);
|
|
1720
|
+
* console.log(updated_array1);
|
|
1721
|
+
* // Output: "two"
|
|
1722
|
+
* // The elements in the list at `testKey1` after blmove command.
|
|
1599
1723
|
*
|
|
1600
1724
|
* const updated_array2 = await client.lrange("testKey2", 0, -1);
|
|
1601
|
-
* console.log(updated_array2);
|
|
1725
|
+
* console.log(updated_array2);
|
|
1726
|
+
* // Output: ["one", "three", "four"]
|
|
1727
|
+
* // The elements in the list at `testKey2` after blmove command.
|
|
1602
1728
|
* ```
|
|
1603
1729
|
*/
|
|
1604
1730
|
blmove(source: GlideString, destination: GlideString, whereFrom: ListDirection, whereTo: ListDirection, timeout: number, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1618,8 +1744,10 @@ export declare class BaseClient {
|
|
|
1618
1744
|
* @example
|
|
1619
1745
|
* ```typescript
|
|
1620
1746
|
* // Example usage of the lset method
|
|
1621
|
-
* const
|
|
1622
|
-
* console.log(
|
|
1747
|
+
* const result = await client.lset("test_key", 1, "two");
|
|
1748
|
+
* console.log(result);
|
|
1749
|
+
* // Output: 'OK'
|
|
1750
|
+
* // Indicates that the second index of the list has been set to "two".
|
|
1623
1751
|
* ```
|
|
1624
1752
|
*/
|
|
1625
1753
|
lset(key: GlideString, index: number, element: GlideString): Promise<"OK">;
|
|
@@ -1642,7 +1770,9 @@ export declare class BaseClient {
|
|
|
1642
1770
|
* ```typescript
|
|
1643
1771
|
* // Example usage of the ltrim method
|
|
1644
1772
|
* const result = await client.ltrim("my_list", 0, 1);
|
|
1645
|
-
* console.log(result);
|
|
1773
|
+
* console.log(result);
|
|
1774
|
+
* // Output: 'OK'
|
|
1775
|
+
* // Indicates that the list has been trimmed to contain elements from 0 to 1.
|
|
1646
1776
|
* ```
|
|
1647
1777
|
*/
|
|
1648
1778
|
ltrim(key: GlideString, start: number, end: number): Promise<"OK">;
|
|
@@ -1661,7 +1791,9 @@ export declare class BaseClient {
|
|
|
1661
1791
|
* ```typescript
|
|
1662
1792
|
* // Example usage of the lrem method
|
|
1663
1793
|
* const result = await client.lrem("my_list", 2, "value");
|
|
1664
|
-
* console.log(result);
|
|
1794
|
+
* console.log(result);
|
|
1795
|
+
* // Output: 2
|
|
1796
|
+
* // Removes the first 2 occurrences of "value" in the list.
|
|
1665
1797
|
* ```
|
|
1666
1798
|
*/
|
|
1667
1799
|
lrem(key: GlideString, count: number, element: GlideString): Promise<number>;
|
|
@@ -1679,14 +1811,17 @@ export declare class BaseClient {
|
|
|
1679
1811
|
* ```typescript
|
|
1680
1812
|
* // Example usage of the rpush method with an existing list
|
|
1681
1813
|
* const result = await client.rpush("my_list", ["value2", "value3"]);
|
|
1682
|
-
* console.log(result);
|
|
1814
|
+
* console.log(result);
|
|
1815
|
+
* // Output: 3
|
|
1816
|
+
* // Indicates that the new length of the list is 3 after the push operation.
|
|
1683
1817
|
* ```
|
|
1684
1818
|
*
|
|
1685
1819
|
* @example
|
|
1686
1820
|
* ```typescript
|
|
1687
1821
|
* // Example usage of the rpush method with a non-existing list
|
|
1688
1822
|
* const result = await client.rpush("nonexistent_list", ["new_value"]);
|
|
1689
|
-
* console.log(result);
|
|
1823
|
+
* console.log(result);
|
|
1824
|
+
* // Output: 1
|
|
1690
1825
|
* ```
|
|
1691
1826
|
*/
|
|
1692
1827
|
rpush(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1702,7 +1837,9 @@ export declare class BaseClient {
|
|
|
1702
1837
|
* @example
|
|
1703
1838
|
* ```typescript
|
|
1704
1839
|
* const result = await client.rpushx("my_list", ["value1", "value2"]);
|
|
1705
|
-
* console.log(result);
|
|
1840
|
+
* console.log(result);
|
|
1841
|
+
* // Output: 2
|
|
1842
|
+
* // Indicates that the list has two elements.
|
|
1706
1843
|
* ```
|
|
1707
1844
|
* */
|
|
1708
1845
|
rpushx(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1720,14 +1857,18 @@ export declare class BaseClient {
|
|
|
1720
1857
|
* ```typescript
|
|
1721
1858
|
* // Example usage of the rpop method with an existing list
|
|
1722
1859
|
* const result = await client.rpop("my_list");
|
|
1723
|
-
* console.log(result);
|
|
1860
|
+
* console.log(result);
|
|
1861
|
+
* // Output: 'value1'
|
|
1862
|
+
* // Returns and removes the last element of the list stored at `my_list`.
|
|
1724
1863
|
* ```
|
|
1725
1864
|
*
|
|
1726
1865
|
* @example
|
|
1727
1866
|
* ```typescript
|
|
1728
1867
|
* // Example usage of the rpop method with a non-existing list
|
|
1729
1868
|
* const result = await client.rpop("non_exiting_key");
|
|
1730
|
-
* console.log(result);
|
|
1869
|
+
* console.log(result);
|
|
1870
|
+
* // Output: null
|
|
1871
|
+
* // Returns null for non-existent key.
|
|
1731
1872
|
* ```
|
|
1732
1873
|
*/
|
|
1733
1874
|
rpop(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1745,14 +1886,18 @@ export declare class BaseClient {
|
|
|
1745
1886
|
* ```typescript
|
|
1746
1887
|
* // Example usage of the rpopCount method with an existing list
|
|
1747
1888
|
* const result = await client.rpopCount("my_list", 2);
|
|
1748
|
-
* console.log(result);
|
|
1889
|
+
* console.log(result);
|
|
1890
|
+
* // Output: ["value1", "value2"]
|
|
1891
|
+
* // Returns and removes the last 2 elements from the list stored at `my_list`.
|
|
1749
1892
|
* ```
|
|
1750
1893
|
*
|
|
1751
1894
|
* @example
|
|
1752
1895
|
* ```typescript
|
|
1753
1896
|
* // Example usage of the rpopCount method with a non-existing list
|
|
1754
1897
|
* const result = await client.rpopCount("non_exiting_key", 7);
|
|
1755
|
-
* console.log(result);
|
|
1898
|
+
* console.log(result);
|
|
1899
|
+
* // Output: null
|
|
1900
|
+
* // Returns null for a non-existing key.
|
|
1756
1901
|
* ```
|
|
1757
1902
|
*/
|
|
1758
1903
|
rpopCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[] | null>;
|
|
@@ -1769,7 +1914,9 @@ export declare class BaseClient {
|
|
|
1769
1914
|
* ```typescript
|
|
1770
1915
|
* // Example usage of the sadd method with an existing set
|
|
1771
1916
|
* const result = await client.sadd("my_set", ["member1", "member2"]);
|
|
1772
|
-
* console.log(result);
|
|
1917
|
+
* console.log(result);
|
|
1918
|
+
* // Output: 2
|
|
1919
|
+
* // Adds 2 members to the set at key `my_set`
|
|
1773
1920
|
* ```
|
|
1774
1921
|
*/
|
|
1775
1922
|
sadd(key: GlideString, members: GlideString[]): Promise<number>;
|
|
@@ -1786,7 +1933,9 @@ export declare class BaseClient {
|
|
|
1786
1933
|
* ```typescript
|
|
1787
1934
|
* // Example usage of the srem method
|
|
1788
1935
|
* const result = await client.srem("my_set", ["member1", "member2"]);
|
|
1789
|
-
* console.log(result);
|
|
1936
|
+
* console.log(result);
|
|
1937
|
+
* // Output: 2
|
|
1938
|
+
* // Removes `member1` and `member2` from the set at key `my_set`.
|
|
1790
1939
|
* ```
|
|
1791
1940
|
*/
|
|
1792
1941
|
srem(key: GlideString, members: GlideString[]): Promise<number>;
|
|
@@ -1840,7 +1989,8 @@ export declare class BaseClient {
|
|
|
1840
1989
|
* ```typescript
|
|
1841
1990
|
* // Example usage of the smembers method
|
|
1842
1991
|
* const result = await client.smembers("my_set");
|
|
1843
|
-
* console.log(result);
|
|
1992
|
+
* console.log(result);
|
|
1993
|
+
* // Output: Set(3) {'member1', 'member2', 'member3'}
|
|
1844
1994
|
* ```
|
|
1845
1995
|
*/
|
|
1846
1996
|
smembers(key: GlideString, options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -1858,7 +2008,9 @@ export declare class BaseClient {
|
|
|
1858
2008
|
* @example
|
|
1859
2009
|
* ```typescript
|
|
1860
2010
|
* const result = await client.smove("set1", "set2", "member1");
|
|
1861
|
-
* console.log(result);
|
|
2011
|
+
* console.log(result);
|
|
2012
|
+
* // Output: true
|
|
2013
|
+
* // `member1` was moved from `set1` to `set2`.
|
|
1862
2014
|
* ```
|
|
1863
2015
|
*/
|
|
1864
2016
|
smove(source: GlideString, destination: GlideString, member: GlideString): Promise<boolean>;
|
|
@@ -1873,7 +2025,8 @@ export declare class BaseClient {
|
|
|
1873
2025
|
* ```typescript
|
|
1874
2026
|
* // Example usage of the scard method
|
|
1875
2027
|
* const result = await client.scard("my_set");
|
|
1876
|
-
* console.log(result);
|
|
2028
|
+
* console.log(result);
|
|
2029
|
+
* // Output: 3
|
|
1877
2030
|
* ```
|
|
1878
2031
|
*/
|
|
1879
2032
|
scard(key: GlideString): Promise<number>;
|
|
@@ -1891,14 +2044,18 @@ export declare class BaseClient {
|
|
|
1891
2044
|
* ```typescript
|
|
1892
2045
|
* // Example usage of sinter method when member exists
|
|
1893
2046
|
* const result = await client.sinter(["my_set1", "my_set2"]);
|
|
1894
|
-
* console.log(result);
|
|
2047
|
+
* console.log(result);
|
|
2048
|
+
* // Output: Set(1) {'member2'}
|
|
2049
|
+
* // Indicates that sets have one common member
|
|
1895
2050
|
* ```
|
|
1896
2051
|
*
|
|
1897
2052
|
* @example
|
|
1898
2053
|
* ```typescript
|
|
1899
2054
|
* // Example usage of sinter method with non-existing key
|
|
1900
2055
|
* const result = await client.sinter(["my_set", "non_existing_key"]);
|
|
1901
|
-
* console.log(result);
|
|
2056
|
+
* console.log(result);
|
|
2057
|
+
* // Output: Set(0) {}
|
|
2058
|
+
* // An empty set is returned since the key does not exist.
|
|
1902
2059
|
* ```
|
|
1903
2060
|
*/
|
|
1904
2061
|
sinter(keys: GlideString[], options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -1919,10 +2076,14 @@ export declare class BaseClient {
|
|
|
1919
2076
|
* await client.sadd("set1", ["a", "b", "c"]);
|
|
1920
2077
|
* await client.sadd("set2", ["b", "c", "d"]);
|
|
1921
2078
|
* const result1 = await client.sintercard(["set1", "set2"]);
|
|
1922
|
-
* console.log(result1);
|
|
2079
|
+
* console.log(result1);
|
|
2080
|
+
* // Output: 2
|
|
2081
|
+
* // The intersection of `set1` and `set2` contains 2 elements: `b` and `c`.
|
|
1923
2082
|
*
|
|
1924
2083
|
* const result2 = await client.sintercard(["set1", "set2"], { limit: 1 });
|
|
1925
|
-
* console.log(result2);
|
|
2084
|
+
* console.log(result2);
|
|
2085
|
+
* // Output: 1
|
|
2086
|
+
* // The computation stops early as the intersection cardinality reaches the limit of 1.
|
|
1926
2087
|
* ```
|
|
1927
2088
|
*/
|
|
1928
2089
|
sintercard(keys: GlideString[], options?: {
|
|
@@ -1941,7 +2102,9 @@ export declare class BaseClient {
|
|
|
1941
2102
|
* @example
|
|
1942
2103
|
* ```typescript
|
|
1943
2104
|
* const result = await client.sinterstore("my_set", ["set1", "set2"]);
|
|
1944
|
-
* console.log(result);
|
|
2105
|
+
* console.log(result);
|
|
2106
|
+
* // Output: 2
|
|
2107
|
+
* // Two elements were stored at `my_set`, and those elements are the intersection of `set1` and `set2`.
|
|
1945
2108
|
* ```
|
|
1946
2109
|
*/
|
|
1947
2110
|
sinterstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -1961,7 +2124,9 @@ export declare class BaseClient {
|
|
|
1961
2124
|
* await client.sadd("set1", ["member1", "member2"]);
|
|
1962
2125
|
* await client.sadd("set2", ["member1"]);
|
|
1963
2126
|
* const result = await client.sdiff(["set1", "set2"]);
|
|
1964
|
-
* console.log(result);
|
|
2127
|
+
* console.log(result);
|
|
2128
|
+
* // Output: Set(1) {"member1"}
|
|
2129
|
+
* // `member2` is in `set1` but not `set2`
|
|
1965
2130
|
* ```
|
|
1966
2131
|
*/
|
|
1967
2132
|
sdiff(keys: GlideString[], options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -1980,7 +2145,9 @@ export declare class BaseClient {
|
|
|
1980
2145
|
* await client.sadd("set1", ["member1", "member2"]);
|
|
1981
2146
|
* await client.sadd("set2", ["member1"]);
|
|
1982
2147
|
* const result = await client.sdiffstore("set3", ["set1", "set2"]);
|
|
1983
|
-
* console.log(result);
|
|
2148
|
+
* console.log(result);
|
|
2149
|
+
* // Output: 1
|
|
2150
|
+
* // One member was stored in `set3`, and that member is the diff between `set1` and `set2`.
|
|
1984
2151
|
* ```
|
|
1985
2152
|
*/
|
|
1986
2153
|
sdiffstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -2000,10 +2167,13 @@ export declare class BaseClient {
|
|
|
2000
2167
|
* await client.sadd("my_set1", ["member1", "member2"]);
|
|
2001
2168
|
* await client.sadd("my_set2", ["member2", "member3"]);
|
|
2002
2169
|
* const result1 = await client.sunion(["my_set1", "my_set2"]);
|
|
2003
|
-
* console.log(result1);
|
|
2170
|
+
* console.log(result1);
|
|
2171
|
+
* // Output: Set(3) {'member1', 'member2', 'member3'}
|
|
2172
|
+
* // Sets `my_set1` and `my_set2` have three unique members.
|
|
2004
2173
|
*
|
|
2005
2174
|
* const result2 = await client.sunion(["my_set1", "non_existing_set"]);
|
|
2006
|
-
* console.log(result2);
|
|
2175
|
+
* console.log(result2);
|
|
2176
|
+
* // Output: Set(2) {'member1', 'member2'}
|
|
2007
2177
|
* ```
|
|
2008
2178
|
*/
|
|
2009
2179
|
sunion(keys: GlideString[], options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -2021,7 +2191,9 @@ export declare class BaseClient {
|
|
|
2021
2191
|
* @example
|
|
2022
2192
|
* ```typescript
|
|
2023
2193
|
* const length = await client.sunionstore("mySet", ["set1", "set2"]);
|
|
2024
|
-
* console.log(length);
|
|
2194
|
+
* console.log(length);
|
|
2195
|
+
* // Output: 2
|
|
2196
|
+
* // Two elements were stored in `mySet`, and those two members are the union of `set1` and `set2`.
|
|
2025
2197
|
* ```
|
|
2026
2198
|
*/
|
|
2027
2199
|
sunionstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -2038,14 +2210,18 @@ export declare class BaseClient {
|
|
|
2038
2210
|
* ```typescript
|
|
2039
2211
|
* // Example usage of the sismember method when member exists
|
|
2040
2212
|
* const result = await client.sismember("my_set", "member1");
|
|
2041
|
-
* console.log(result);
|
|
2213
|
+
* console.log(result);
|
|
2214
|
+
* // Output: true
|
|
2215
|
+
* // Indicates that `member1` exists in the set `my_set`.
|
|
2042
2216
|
* ```
|
|
2043
2217
|
*
|
|
2044
2218
|
* @example
|
|
2045
2219
|
* ```typescript
|
|
2046
2220
|
* // Example usage of the sismember method when member does not exist
|
|
2047
2221
|
* const result = await client.sismember("my_set", "non_existing_member");
|
|
2048
|
-
* console.log(result);
|
|
2222
|
+
* console.log(result);
|
|
2223
|
+
* // Output: false
|
|
2224
|
+
* // Indicates that `non_existing_member` does not exist in the set `my_set`.
|
|
2049
2225
|
* ```
|
|
2050
2226
|
*/
|
|
2051
2227
|
sismember(key: GlideString, member: GlideString): Promise<boolean>;
|
|
@@ -2063,7 +2239,9 @@ export declare class BaseClient {
|
|
|
2063
2239
|
* ```typescript
|
|
2064
2240
|
* await client.sadd("set1", ["a", "b", "c"]);
|
|
2065
2241
|
* const result = await client.smismember("set1", ["b", "c", "d"]);
|
|
2066
|
-
* console.log(result);
|
|
2242
|
+
* console.log(result);
|
|
2243
|
+
* // Output: [true, true, false]
|
|
2244
|
+
* // `b` and `c` are members of `set1`, but `d` is not.
|
|
2067
2245
|
* ```
|
|
2068
2246
|
*/
|
|
2069
2247
|
smismember(key: GlideString, members: GlideString[]): Promise<boolean[]>;
|
|
@@ -2081,14 +2259,17 @@ export declare class BaseClient {
|
|
|
2081
2259
|
* ```typescript
|
|
2082
2260
|
* // Example usage of spop method to remove and return a random member from a set
|
|
2083
2261
|
* const result = await client.spop("my_set");
|
|
2084
|
-
* console.log(result);
|
|
2262
|
+
* console.log(result);
|
|
2263
|
+
* // Output: 'member1'
|
|
2264
|
+
* // Removes and returns a random member from the set `my_set`.
|
|
2085
2265
|
* ```
|
|
2086
2266
|
*
|
|
2087
2267
|
* @example
|
|
2088
2268
|
* ```typescript
|
|
2089
2269
|
* // Example usage of spop method with non-existing key
|
|
2090
2270
|
* const result = await client.spop("non_existing_key");
|
|
2091
|
-
* console.log(result);
|
|
2271
|
+
* console.log(result);
|
|
2272
|
+
* // Output: null
|
|
2092
2273
|
* ```
|
|
2093
2274
|
*/
|
|
2094
2275
|
spop(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -2106,14 +2287,18 @@ export declare class BaseClient {
|
|
|
2106
2287
|
* ```typescript
|
|
2107
2288
|
* // Example usage of spopCount method to remove and return multiple random members from a set
|
|
2108
2289
|
* const result = await client.spopCount("my_set", 2);
|
|
2109
|
-
* console.log(result);
|
|
2290
|
+
* console.log(result);
|
|
2291
|
+
* // Output: Set(2) {'member2', 'member3'}
|
|
2292
|
+
* // Removes and returns 2 random members from the set `my_set`.
|
|
2110
2293
|
* ```
|
|
2111
2294
|
*
|
|
2112
2295
|
* @example
|
|
2113
2296
|
* ```typescript
|
|
2114
2297
|
* // Example usage of spopCount method with non-existing key
|
|
2115
2298
|
* const result = await client.spopCount("non_existing_key");
|
|
2116
|
-
* console.log(result);
|
|
2299
|
+
* console.log(result);
|
|
2300
|
+
* // Output: Set(0) {}
|
|
2301
|
+
* // An empty set is returned since the key does not exist.
|
|
2117
2302
|
* ```
|
|
2118
2303
|
*/
|
|
2119
2304
|
spopCount(key: GlideString, count: number, options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -2130,14 +2315,17 @@ export declare class BaseClient {
|
|
|
2130
2315
|
* ```typescript
|
|
2131
2316
|
* // Example usage of srandmember method to return a random member from a set
|
|
2132
2317
|
* const result = await client.srandmember("my_set");
|
|
2133
|
-
* console.log(result);
|
|
2318
|
+
* console.log(result);
|
|
2319
|
+
* // Output: 'member1'
|
|
2320
|
+
* // A random member of `my_set`.
|
|
2134
2321
|
* ```
|
|
2135
2322
|
*
|
|
2136
2323
|
* @example
|
|
2137
2324
|
* ```typescript
|
|
2138
2325
|
* // Example usage of srandmember method with non-existing key
|
|
2139
2326
|
* const result = await client.srandmember("non_existing_set");
|
|
2140
|
-
* console.log(result);
|
|
2327
|
+
* console.log(result);
|
|
2328
|
+
* // Output: null
|
|
2141
2329
|
* ```
|
|
2142
2330
|
*/
|
|
2143
2331
|
srandmember(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -2157,14 +2345,18 @@ export declare class BaseClient {
|
|
|
2157
2345
|
* ```typescript
|
|
2158
2346
|
* // Example usage of srandmemberCount method to return multiple random members from a set
|
|
2159
2347
|
* const result = await client.srandmemberCount("my_set", -3);
|
|
2160
|
-
* console.log(result);
|
|
2348
|
+
* console.log(result);
|
|
2349
|
+
* // Output: ['member1', 'member1', 'member2']
|
|
2350
|
+
* // Random members of `my_set`.
|
|
2161
2351
|
* ```
|
|
2162
2352
|
*
|
|
2163
2353
|
* @example
|
|
2164
2354
|
* ```typescript
|
|
2165
2355
|
* // Example usage of srandmemberCount method with non-existing key
|
|
2166
2356
|
* const result = await client.srandmemberCount("non_existing_set", 3);
|
|
2167
|
-
* console.log(result);
|
|
2357
|
+
* console.log(result);
|
|
2358
|
+
* // Output: []
|
|
2359
|
+
* // An empty list since the key does not exist.
|
|
2168
2360
|
* ```
|
|
2169
2361
|
*/
|
|
2170
2362
|
srandmemberCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -2189,7 +2381,9 @@ export declare class BaseClient {
|
|
|
2189
2381
|
* ```typescript
|
|
2190
2382
|
* // Example usage of the exists method
|
|
2191
2383
|
* const result = await client.exists(["key1", "key2", "key3"]);
|
|
2192
|
-
* console.log(result);
|
|
2384
|
+
* console.log(result);
|
|
2385
|
+
* // Output: 3
|
|
2386
|
+
* // Indicates that all three keys exist in the database.
|
|
2193
2387
|
* ```
|
|
2194
2388
|
*/
|
|
2195
2389
|
exists(keys: GlideString[]): Promise<number>;
|
|
@@ -2215,7 +2409,9 @@ export declare class BaseClient {
|
|
|
2215
2409
|
* ```typescript
|
|
2216
2410
|
* // Example usage of the unlink method
|
|
2217
2411
|
* const result = await client.unlink(["key1", "key2", "key3"]);
|
|
2218
|
-
* console.log(result);
|
|
2412
|
+
* console.log(result);
|
|
2413
|
+
* // Output: 3
|
|
2414
|
+
* // Indicates that all three keys were unlinked from the database.
|
|
2219
2415
|
* ```
|
|
2220
2416
|
*/
|
|
2221
2417
|
unlink(keys: GlideString[]): Promise<number>;
|
|
@@ -2238,14 +2434,18 @@ export declare class BaseClient {
|
|
|
2238
2434
|
* ```typescript
|
|
2239
2435
|
* // Example usage of the expire method
|
|
2240
2436
|
* const result = await client.expire("my_key", 60);
|
|
2241
|
-
* console.log(result);
|
|
2437
|
+
* console.log(result);
|
|
2438
|
+
* // Output: true
|
|
2439
|
+
* // Indicates that a timeout of 60 seconds has been set for `my_key`.
|
|
2242
2440
|
* ```
|
|
2243
2441
|
*
|
|
2244
2442
|
* @example
|
|
2245
2443
|
* ```typescript
|
|
2246
2444
|
* // Example usage of the expire method with exisiting expiry
|
|
2247
2445
|
* const result = await client.expire("my_key", 60, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2248
|
-
* console.log(result);
|
|
2446
|
+
* console.log(result);
|
|
2447
|
+
* // Output: false
|
|
2448
|
+
* // Indicates that `my_key` has an existing expiry.
|
|
2249
2449
|
* ```
|
|
2250
2450
|
*/
|
|
2251
2451
|
expire(key: GlideString, seconds: number, options?: {
|
|
@@ -2270,7 +2470,9 @@ export declare class BaseClient {
|
|
|
2270
2470
|
* ```typescript
|
|
2271
2471
|
* // Example usage of the expireAt method on a key with no previous expiry
|
|
2272
2472
|
* const result = await client.expireAt("my_key", 1672531200, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2273
|
-
* console.log(result);
|
|
2473
|
+
* console.log(result);
|
|
2474
|
+
* // Output: true
|
|
2475
|
+
* // Indicates that the expiration time for `my_key` was successfully set.
|
|
2274
2476
|
* ```
|
|
2275
2477
|
*/
|
|
2276
2478
|
expireAt(key: GlideString, unixSeconds: number, options?: {
|
|
@@ -2289,15 +2491,21 @@ export declare class BaseClient {
|
|
|
2289
2491
|
* @example
|
|
2290
2492
|
* ```typescript
|
|
2291
2493
|
* const result1 = await client.expiretime("myKey");
|
|
2292
|
-
* console.log(result1);
|
|
2494
|
+
* console.log(result1);
|
|
2495
|
+
* // Output: -2
|
|
2496
|
+
* // `myKey` doesn't exist.
|
|
2293
2497
|
*
|
|
2294
|
-
* const result2 = await client.set(myKey, "value");
|
|
2295
|
-
* const result3 = await client.expireTime(myKey);
|
|
2296
|
-
* console.log(
|
|
2498
|
+
* const result2 = await client.set("myKey", "value");
|
|
2499
|
+
* const result3 = await client.expireTime("myKey");
|
|
2500
|
+
* console.log(result3);
|
|
2501
|
+
* // Output: -1
|
|
2502
|
+
* // `myKey` has no associated expiration.
|
|
2297
2503
|
*
|
|
2298
2504
|
* client.expire(myKey, 60);
|
|
2299
|
-
* const result3 = await client.expireTime(myKey);
|
|
2300
|
-
* console.log(result3);
|
|
2505
|
+
* const result3 = await client.expireTime("myKey");
|
|
2506
|
+
* console.log(result3);
|
|
2507
|
+
* // Output: 123456
|
|
2508
|
+
* // The Unix timestamp (in seconds) when `myKey` will expire.
|
|
2301
2509
|
* ```
|
|
2302
2510
|
*/
|
|
2303
2511
|
expiretime(key: GlideString): Promise<number>;
|
|
@@ -2320,7 +2528,9 @@ export declare class BaseClient {
|
|
|
2320
2528
|
* ```typescript
|
|
2321
2529
|
* // Example usage of the pexpire method on a key with no previous expiry
|
|
2322
2530
|
* const result = await client.pexpire("my_key", 60000, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2323
|
-
* console.log(result);
|
|
2531
|
+
* console.log(result);
|
|
2532
|
+
* // Output: true
|
|
2533
|
+
* // Indicates that a timeout of 60,000 milliseconds has been set for `my_key`.
|
|
2324
2534
|
* ```
|
|
2325
2535
|
*/
|
|
2326
2536
|
pexpire(key: GlideString, milliseconds: number, options?: {
|
|
@@ -2345,7 +2555,9 @@ export declare class BaseClient {
|
|
|
2345
2555
|
* ```typescript
|
|
2346
2556
|
* // Example usage of the pexpireAt method on a key with no previous expiry
|
|
2347
2557
|
* const result = await client.pexpireAt("my_key", 1672531200000, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2348
|
-
* console.log(result);
|
|
2558
|
+
* console.log(result);
|
|
2559
|
+
* // Output: true
|
|
2560
|
+
* // Indicates that the expiration time for `my_key` was successfully set.
|
|
2349
2561
|
* ```
|
|
2350
2562
|
*/
|
|
2351
2563
|
pexpireAt(key: GlideString, unixMilliseconds: number, options?: {
|
|
@@ -2363,15 +2575,21 @@ export declare class BaseClient {
|
|
|
2363
2575
|
* @example
|
|
2364
2576
|
* ```typescript
|
|
2365
2577
|
* const result1 = client.pexpiretime("myKey");
|
|
2366
|
-
* console.log(result1);
|
|
2578
|
+
* console.log(result1);
|
|
2579
|
+
* // Output: -2
|
|
2580
|
+
* // `myKey` doesn't exist.
|
|
2367
2581
|
*
|
|
2368
2582
|
* const result2 = client.set(myKey, "value");
|
|
2369
2583
|
* const result3 = client.pexpireTime(myKey);
|
|
2370
|
-
* console.log(result2);
|
|
2584
|
+
* console.log(result2);
|
|
2585
|
+
* // Output: -1
|
|
2586
|
+
* // `myKey` has no associated expiration.
|
|
2371
2587
|
*
|
|
2372
2588
|
* client.expire(myKey, 60);
|
|
2373
2589
|
* const result3 = client.pexpireTime(myKey);
|
|
2374
|
-
* console.log(result3);
|
|
2590
|
+
* console.log(result3);
|
|
2591
|
+
* // Output: 123456789
|
|
2592
|
+
* // The Unix timestamp (in milliseconds) when `myKey` will expire.
|
|
2375
2593
|
* ```
|
|
2376
2594
|
*/
|
|
2377
2595
|
pexpiretime(key: GlideString): Promise<number>;
|
|
@@ -2387,21 +2605,27 @@ export declare class BaseClient {
|
|
|
2387
2605
|
* ```typescript
|
|
2388
2606
|
* // Example usage of the ttl method with existing key
|
|
2389
2607
|
* const result = await client.ttl("my_key");
|
|
2390
|
-
* console.log(result);
|
|
2608
|
+
* console.log(result);
|
|
2609
|
+
* // Output: 3600
|
|
2610
|
+
* // Indicates that `my_key` has a remaining time to live of 3600 seconds.
|
|
2391
2611
|
* ```
|
|
2392
2612
|
*
|
|
2393
2613
|
* @example
|
|
2394
2614
|
* ```typescript
|
|
2395
2615
|
* // Example usage of the ttl method with existing key that has no associated expire.
|
|
2396
2616
|
* const result = await client.ttl("key");
|
|
2397
|
-
* console.log(result);
|
|
2617
|
+
* console.log(result);
|
|
2618
|
+
* // Output: -1
|
|
2619
|
+
* // Indicates that the key has no associated expire.
|
|
2398
2620
|
* ```
|
|
2399
2621
|
*
|
|
2400
2622
|
* @example
|
|
2401
2623
|
* ```typescript
|
|
2402
2624
|
* // Example usage of the ttl method with a non-existing key
|
|
2403
2625
|
* const result = await client.ttl("nonexistent_key");
|
|
2404
|
-
* console.log(result);
|
|
2626
|
+
* console.log(result);
|
|
2627
|
+
* // Output: -2
|
|
2628
|
+
* // Indicates that the key doesn't exist.
|
|
2405
2629
|
* ```
|
|
2406
2630
|
*/
|
|
2407
2631
|
ttl(key: GlideString): Promise<number>;
|
|
@@ -2429,7 +2653,9 @@ export declare class BaseClient {
|
|
|
2429
2653
|
* args: ["bar"],
|
|
2430
2654
|
* };
|
|
2431
2655
|
* const result = await invokeScript(luaScript, scriptOptions);
|
|
2432
|
-
* console.log(result);
|
|
2656
|
+
* console.log(result);
|
|
2657
|
+
* // Output: ['foo', 'bar']
|
|
2658
|
+
* // The result for the script.
|
|
2433
2659
|
* ```
|
|
2434
2660
|
*/
|
|
2435
2661
|
invokeScript(script: Script, options?: {
|
|
@@ -2451,7 +2677,9 @@ export declare class BaseClient {
|
|
|
2451
2677
|
* ```typescript
|
|
2452
2678
|
* const scriptHash = script.getHash();
|
|
2453
2679
|
* const scriptSource = await client.scriptShow(scriptHash);
|
|
2454
|
-
* console.log(scriptSource);
|
|
2680
|
+
* console.log(scriptSource);
|
|
2681
|
+
* // Output: "return { KEYS[1], ARGV[1] }"
|
|
2682
|
+
* // The source for the script
|
|
2455
2683
|
* ```
|
|
2456
2684
|
*/
|
|
2457
2685
|
scriptShow(sha1: GlideString, options?: DecoderOption): Promise<GlideString>;
|
|
@@ -2484,7 +2712,8 @@ export declare class BaseClient {
|
|
|
2484
2712
|
* // {
|
|
2485
2713
|
* // "0-1": [["field1", "value1"]],
|
|
2486
2714
|
* // "0-2": [["field2", "value2"], ["field2", "value3"]],
|
|
2487
|
-
* // }
|
|
2715
|
+
* // }
|
|
2716
|
+
* // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in `mystream`.
|
|
2488
2717
|
* ```
|
|
2489
2718
|
*/
|
|
2490
2719
|
xrange(key: GlideString, start: Boundary<string>, end: Boundary<string>, options?: {
|
|
@@ -2520,7 +2749,8 @@ export declare class BaseClient {
|
|
|
2520
2749
|
* // {
|
|
2521
2750
|
* // "0-2": [["field2", "value2"], ["field2", "value3"]],
|
|
2522
2751
|
* // "0-1": [["field1", "value1"]],
|
|
2523
|
-
* // }
|
|
2752
|
+
* // }
|
|
2753
|
+
* // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in `mystream`.
|
|
2524
2754
|
* ```
|
|
2525
2755
|
*/
|
|
2526
2756
|
xrevrange(key: GlideString, end: Boundary<string>, start: Boundary<string>, options?: {
|
|
@@ -2543,7 +2773,9 @@ export declare class BaseClient {
|
|
|
2543
2773
|
* // Example usage of the zadd method to add elements to a sorted set
|
|
2544
2774
|
* const data = [{ element: "member1", score: 10.5 }, { element: "member2", score: 8.2 }]
|
|
2545
2775
|
* const result = await client.zadd("my_sorted_set", data);
|
|
2546
|
-
* console.log(result);
|
|
2776
|
+
* console.log(result);
|
|
2777
|
+
* // Output: 2
|
|
2778
|
+
* // Indicates that two elements have been added to the sorted set `my_sorted_set`.
|
|
2547
2779
|
* ```
|
|
2548
2780
|
*
|
|
2549
2781
|
* @example
|
|
@@ -2551,7 +2783,9 @@ export declare class BaseClient {
|
|
|
2551
2783
|
* // Example usage of the zadd method to update scores in an existing sorted set
|
|
2552
2784
|
* const options = { conditionalChange: ConditionalChange.ONLY_IF_EXISTS, changed: true };
|
|
2553
2785
|
* const result = await client.zadd("existing_sorted_set", { "member1": 10.5, "member2": 8.2 }, options);
|
|
2554
|
-
* console.log(result);
|
|
2786
|
+
* console.log(result);
|
|
2787
|
+
* // Output: 2
|
|
2788
|
+
* // Updates the scores of two existing members in the sorted set `existing_sorted_set`.
|
|
2555
2789
|
* ```
|
|
2556
2790
|
*/
|
|
2557
2791
|
zadd(key: GlideString, membersAndScores: ElementAndScore[] | Record<string, Score>, options?: ZAddOptions): Promise<number>;
|
|
@@ -2573,14 +2807,18 @@ export declare class BaseClient {
|
|
|
2573
2807
|
* ```typescript
|
|
2574
2808
|
* // Example usage of the zaddIncr method to add a member with a score to a sorted set
|
|
2575
2809
|
* const result = await client.zaddIncr("my_sorted_set", member, 5.0);
|
|
2576
|
-
* console.log(result);
|
|
2810
|
+
* console.log(result);
|
|
2811
|
+
* // Output: 5.0
|
|
2812
|
+
* // Score of the member after being updated.
|
|
2577
2813
|
* ```
|
|
2578
2814
|
*
|
|
2579
2815
|
* @example
|
|
2580
2816
|
* ```typescript
|
|
2581
2817
|
* // Example usage of the zaddIncr method to add or update a member with a score in an existing sorted set
|
|
2582
2818
|
* const result = await client.zaddIncr("existing_sorted_set", member, "3.0", { updateOptions: UpdateByScore.LESS_THAN });
|
|
2583
|
-
* console.log(result);
|
|
2819
|
+
* console.log(result);
|
|
2820
|
+
* // Output: null
|
|
2821
|
+
* // Indicates that the member in the sorted set haven't been updated.
|
|
2584
2822
|
* ```
|
|
2585
2823
|
*/
|
|
2586
2824
|
zaddIncr(key: GlideString, member: GlideString, increment: number, options?: ZAddOptions): Promise<number | null>;
|
|
@@ -2599,14 +2837,18 @@ export declare class BaseClient {
|
|
|
2599
2837
|
* ```typescript
|
|
2600
2838
|
* // Example usage of the zrem function to remove members from a sorted set
|
|
2601
2839
|
* const result = await client.zrem("my_sorted_set", ["member1", "member2"]);
|
|
2602
|
-
* console.log(result);
|
|
2840
|
+
* console.log(result);
|
|
2841
|
+
* // Output: 2
|
|
2842
|
+
* // Indicates that two members have been removed from the sorted set `my_sorted_set`.
|
|
2603
2843
|
* ```
|
|
2604
2844
|
*
|
|
2605
2845
|
* @example
|
|
2606
2846
|
* ```typescript
|
|
2607
2847
|
* // Example usage of the zrem function when the sorted set does not exist
|
|
2608
2848
|
* const result = await client.zrem("non_existing_sorted_set", ["member1", "member2"]);
|
|
2609
|
-
* console.log(result);
|
|
2849
|
+
* console.log(result);
|
|
2850
|
+
* // Output: 0
|
|
2851
|
+
* // Indicates that no members were removed as the sorted set `non_existing_sorted_set` does not exist.
|
|
2610
2852
|
* ```
|
|
2611
2853
|
*/
|
|
2612
2854
|
zrem(key: GlideString, members: GlideString[]): Promise<number>;
|
|
@@ -2623,14 +2865,17 @@ export declare class BaseClient {
|
|
|
2623
2865
|
* ```typescript
|
|
2624
2866
|
* // Example usage of the zcard method to get the cardinality of a sorted set
|
|
2625
2867
|
* const result = await client.zcard("my_sorted_set");
|
|
2626
|
-
* console.log(result);
|
|
2868
|
+
* console.log(result);
|
|
2869
|
+
* // Output: 3
|
|
2870
|
+
* // Indicates that there are 3 elements in the sorted set `my_sorted_set`.
|
|
2627
2871
|
* ```
|
|
2628
2872
|
*
|
|
2629
2873
|
* @example
|
|
2630
2874
|
* ```typescript
|
|
2631
2875
|
* // Example usage of the zcard method with a non-existing key
|
|
2632
2876
|
* const result = await client.zcard("non_existing_key");
|
|
2633
|
-
* console.log(result);
|
|
2877
|
+
* console.log(result);
|
|
2878
|
+
* // Output: 0
|
|
2634
2879
|
* ```
|
|
2635
2880
|
*/
|
|
2636
2881
|
zcard(key: GlideString): Promise<number>;
|
|
@@ -2649,7 +2894,9 @@ export declare class BaseClient {
|
|
|
2649
2894
|
* @example
|
|
2650
2895
|
* ```typescript
|
|
2651
2896
|
* const cardinality = await client.zintercard(["key1", "key2"], { limit: 10 });
|
|
2652
|
-
* console.log(cardinality);
|
|
2897
|
+
* console.log(cardinality);
|
|
2898
|
+
* // Output: 3
|
|
2899
|
+
* // The intersection of the sorted sets at `key1` and `key2` has a cardinality of 3.
|
|
2653
2900
|
* ```
|
|
2654
2901
|
*/
|
|
2655
2902
|
zintercard(keys: GlideString[], options?: {
|
|
@@ -2674,7 +2921,9 @@ export declare class BaseClient {
|
|
|
2674
2921
|
* await client.zadd("zset2", {"member2": 2.0});
|
|
2675
2922
|
* await client.zadd("zset3", {"member3": 3.0});
|
|
2676
2923
|
* const result = await client.zdiff(["zset1", "zset2", "zset3"]);
|
|
2677
|
-
* console.log(result);
|
|
2924
|
+
* console.log(result);
|
|
2925
|
+
* // Output: ["member1"]
|
|
2926
|
+
* // `member1` is in `zset1` but not `zset2` or `zset3`.
|
|
2678
2927
|
* ```
|
|
2679
2928
|
*/
|
|
2680
2929
|
zdiff(keys: GlideString[], options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -2697,8 +2946,9 @@ export declare class BaseClient {
|
|
|
2697
2946
|
* await client.zadd("zset2", {"member2": 2.0});
|
|
2698
2947
|
* await client.zadd("zset3", {"member3": 3.0});
|
|
2699
2948
|
* const result = await client.zdiffWithScores(["zset1", "zset2", "zset3"]);
|
|
2700
|
-
* console.log(result);
|
|
2701
|
-
* // [{ element: "member1", score: 1.0 }]
|
|
2949
|
+
* console.log(result);
|
|
2950
|
+
* // Output: [{ element: "member1", score: 1.0 }]
|
|
2951
|
+
* // `member1` is in `zset1` but not `zset2` or `zset3`
|
|
2702
2952
|
* ```
|
|
2703
2953
|
*/
|
|
2704
2954
|
zdiffWithScores(keys: GlideString[], options?: DecoderOption): Promise<SortedSetDataType>;
|
|
@@ -2720,10 +2970,14 @@ export declare class BaseClient {
|
|
|
2720
2970
|
* await client.zadd("zset1", {"member1": 1.0, "member2": 2.0});
|
|
2721
2971
|
* await client.zadd("zset2", {"member1": 1.0});
|
|
2722
2972
|
* const result1 = await client.zdiffstore("zset3", ["zset1", "zset2"]);
|
|
2723
|
-
* console.log(result1);
|
|
2973
|
+
* console.log(result1);
|
|
2974
|
+
* // Output: 1
|
|
2975
|
+
* // One member exists in `key1` but not `key2`, and this member was stored in `zset3`.
|
|
2724
2976
|
*
|
|
2725
2977
|
* const result2 = await client.zrange("zset3", {start: 0, end: -1});
|
|
2726
|
-
* console.log(result2);
|
|
2978
|
+
* console.log(result2);
|
|
2979
|
+
* // Output: ["member2"]
|
|
2980
|
+
* // `member2` is now stored in `my_sorted_set`.
|
|
2727
2981
|
* ```
|
|
2728
2982
|
*/
|
|
2729
2983
|
zdiffstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -2742,21 +2996,25 @@ export declare class BaseClient {
|
|
|
2742
2996
|
* ```typescript
|
|
2743
2997
|
* // Example usage of the zscore method∂∂ to get the score of a member in a sorted set
|
|
2744
2998
|
* const result = await client.zscore("my_sorted_set", "member");
|
|
2745
|
-
* console.log(result);
|
|
2999
|
+
* console.log(result);
|
|
3000
|
+
* // Output: 10.5
|
|
3001
|
+
* // Indicates that the score of `member` in the sorted set `my_sorted_set` is 10.5.
|
|
2746
3002
|
* ```
|
|
2747
3003
|
*
|
|
2748
3004
|
* @example
|
|
2749
3005
|
* ```typescript
|
|
2750
3006
|
* // Example usage of the zscore method when the member does not exist in the sorted set
|
|
2751
3007
|
* const result = await client.zscore("my_sorted_set", "non_existing_member");
|
|
2752
|
-
* console.log(result);
|
|
3008
|
+
* console.log(result);
|
|
3009
|
+
* // Output: null
|
|
2753
3010
|
* ```
|
|
2754
3011
|
*
|
|
2755
3012
|
* @example
|
|
2756
3013
|
* ```typescript
|
|
2757
3014
|
* // Example usage of the zscore method with non existimng key
|
|
2758
3015
|
* const result = await client.zscore("non_existing_set", "member");
|
|
2759
|
-
* console.log(result);
|
|
3016
|
+
* console.log(result);
|
|
3017
|
+
* // Output: null
|
|
2760
3018
|
* ```
|
|
2761
3019
|
*/
|
|
2762
3020
|
zscore(key: GlideString, member: GlideString): Promise<number | null>;
|
|
@@ -2784,25 +3042,35 @@ export declare class BaseClient {
|
|
|
2784
3042
|
*
|
|
2785
3043
|
* // use `zunionstore` with default aggregation and weights
|
|
2786
3044
|
* console.log(await client.zunionstore("my_sorted_set", ["key1", "key2"]))
|
|
2787
|
-
* // Output: 2
|
|
3045
|
+
* // Output: 2
|
|
3046
|
+
* // Indicates that the sorted set `my_sorted_set` contains two elements.
|
|
3047
|
+
*
|
|
2788
3048
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
|
|
2789
|
-
* // Output: {'member1': 20, 'member2': 8.2}
|
|
3049
|
+
* // Output: {'member1': 20, 'member2': 8.2}
|
|
3050
|
+
* // `member1` is now stored in `my_sorted_set` with score of 20 and `member2` with score of 8.2.
|
|
2790
3051
|
* ```
|
|
2791
3052
|
*
|
|
2792
3053
|
* @example
|
|
2793
3054
|
* ```typescript
|
|
2794
3055
|
* // use `zunionstore` with default weights
|
|
2795
3056
|
* console.log(await client.zunionstore("my_sorted_set", ["key1", "key2"], { aggregationType: AggregationType.MAX }))
|
|
2796
|
-
* // Output: 2
|
|
3057
|
+
* // Output: 2
|
|
3058
|
+
* // Indicates that the sorted set `my_sorted_set` contains two elements, and each score is the maximum score between the sets.
|
|
3059
|
+
*
|
|
2797
3060
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
|
|
2798
|
-
* // Output: {'member1': 10.5, 'member2': 8.2}
|
|
3061
|
+
* // Output: {'member1': 10.5, 'member2': 8.2}
|
|
3062
|
+
* // `member1` is now stored in `my_sorted_set` with score of 10.5 and `member2` with score of 8.2.
|
|
2799
3063
|
* ```
|
|
2800
3064
|
*
|
|
2801
3065
|
* @example
|
|
2802
3066
|
* ```typescript
|
|
2803
3067
|
* // use `zunionstore` with default aggregation
|
|
2804
|
-
* console.log(await client.zunionstore("my_sorted_set", [["key1", 2], ["key2", 1]]))
|
|
2805
|
-
*
|
|
3068
|
+
* console.log(await client.zunionstore("my_sorted_set", [["key1", 2], ["key2", 1]]))
|
|
3069
|
+
* // Output: 2
|
|
3070
|
+
* // Indicates that the sorted set `my_sorted_set` contains two elements
|
|
3071
|
+
*
|
|
3072
|
+
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
|
|
3073
|
+
* // Output: { member2: 16.4, member1: 30.5 }
|
|
2806
3074
|
* ```
|
|
2807
3075
|
*/
|
|
2808
3076
|
zunionstore(destination: GlideString, keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -2822,7 +3090,8 @@ export declare class BaseClient {
|
|
|
2822
3090
|
* @example
|
|
2823
3091
|
* ```typescript
|
|
2824
3092
|
* const result = await client.zmscore("zset1", ["member1", "non_existent_member", "member2"]);
|
|
2825
|
-
* console.log(result); // Output: [1.0, null, 2.0]
|
|
3093
|
+
* console.log(result); // Output: [1.0, null, 2.0]
|
|
3094
|
+
* // `member1` has a score of 1.0, `non_existent_member` does not exist in the sorted set, and `member2` has a score of 2.0.
|
|
2826
3095
|
* ```
|
|
2827
3096
|
*/
|
|
2828
3097
|
zmscore(key: GlideString, members: GlideString[]): Promise<(number | null)[]>;
|
|
@@ -2842,14 +3111,18 @@ export declare class BaseClient {
|
|
|
2842
3111
|
* ```typescript
|
|
2843
3112
|
* // Example usage of the zcount method to count members in a sorted set within a score range
|
|
2844
3113
|
* const result = await client.zcount("my_sorted_set", { value: 5.0, isInclusive: true }, InfBoundary.PositiveInfinity);
|
|
2845
|
-
* console.log(result);
|
|
3114
|
+
* console.log(result);
|
|
3115
|
+
* // Output: 2
|
|
3116
|
+
* // Indicates that there are 2 members with scores between 5.0 (inclusive) and +inf in the sorted set `my_sorted_set`.
|
|
2846
3117
|
* ```
|
|
2847
3118
|
*
|
|
2848
3119
|
* @example
|
|
2849
3120
|
* ```typescript
|
|
2850
3121
|
* // Example usage of the zcount method to count members in a sorted set within a score range
|
|
2851
3122
|
* const result = await client.zcount("my_sorted_set", { value: 5.0, isInclusive: true }, { value: 10.0, isInclusive: false });
|
|
2852
|
-
* console.log(result);
|
|
3123
|
+
* console.log(result);
|
|
3124
|
+
* // Output: 1
|
|
3125
|
+
* // Indicates that there is one member with score between 5.0 (inclusive) and 10.0 (exclusive) in the sorted set `my_sorted_set`.
|
|
2853
3126
|
* ```
|
|
2854
3127
|
*/
|
|
2855
3128
|
zcount(key: GlideString, minScore: Boundary<number>, maxScore: Boundary<number>): Promise<number>;
|
|
@@ -2876,8 +3149,9 @@ export declare class BaseClient {
|
|
|
2876
3149
|
* ```typescript
|
|
2877
3150
|
* // Example usage of zrange method to retrieve all members of a sorted set in ascending order
|
|
2878
3151
|
* const result = await client.zrange("my_sorted_set", { start: 0, end: -1 });
|
|
2879
|
-
* console.log(result1);
|
|
2880
|
-
* // ['member1', 'member2', 'member3']
|
|
3152
|
+
* console.log(result1);
|
|
3153
|
+
* // Output: ['member1', 'member2', 'member3']
|
|
3154
|
+
* // All members in ascending order
|
|
2881
3155
|
* ```
|
|
2882
3156
|
* @example
|
|
2883
3157
|
* ```typescript
|
|
@@ -2887,8 +3161,9 @@ export declare class BaseClient {
|
|
|
2887
3161
|
* end: InfBoundary.NegativeInfinity,
|
|
2888
3162
|
* type: "byScore",
|
|
2889
3163
|
* }, { reverse: true });
|
|
2890
|
-
* console.log(result);
|
|
2891
|
-
* // ['member2', 'member1']
|
|
3164
|
+
* console.log(result);
|
|
3165
|
+
* // Output: ['member2', 'member1']
|
|
3166
|
+
* // Members with scores within the range of negative infinity to 3, in descending order
|
|
2892
3167
|
* ```
|
|
2893
3168
|
*/
|
|
2894
3169
|
zrange(key: GlideString, rangeQuery: RangeByScore | RangeByLex | RangeByIndex, options?: {
|
|
@@ -2918,8 +3193,9 @@ export declare class BaseClient {
|
|
|
2918
3193
|
* end: { value: 20, isInclusive: false },
|
|
2919
3194
|
* type: "byScore",
|
|
2920
3195
|
* });
|
|
2921
|
-
* console.log(result);
|
|
2922
|
-
* // [{ element: 'member1', score: 10.5 }, { element: 'member2', score: 15.2 }]
|
|
3196
|
+
* console.log(result);
|
|
3197
|
+
* // Output: [{ element: 'member1', score: 10.5 }, { element: 'member2', score: 15.2 }]
|
|
3198
|
+
* // Members with scores between 10 and 20 with their scores
|
|
2923
3199
|
* ```
|
|
2924
3200
|
* @example
|
|
2925
3201
|
* ```typescript
|
|
@@ -2929,8 +3205,9 @@ export declare class BaseClient {
|
|
|
2929
3205
|
* end: InfBoundary.NegativeInfinity,
|
|
2930
3206
|
* type: "byScore",
|
|
2931
3207
|
* }, { reverse: true });
|
|
2932
|
-
* console.log(result);
|
|
2933
|
-
* // [{ element: 'member7', score: 1.5 }, { element: 'member4', score: -2.0 }]
|
|
3208
|
+
* console.log(result);
|
|
3209
|
+
* // Output: [{ element: 'member7', score: 1.5 }, { element: 'member4', score: -2.0 }]
|
|
3210
|
+
* // Members with scores within the range of negative infinity to 3, with their scores
|
|
2934
3211
|
* ```
|
|
2935
3212
|
*/
|
|
2936
3213
|
zrangeWithScores(key: GlideString, rangeQuery: RangeByScore | RangeByIndex, options?: {
|
|
@@ -2958,17 +3235,21 @@ export declare class BaseClient {
|
|
|
2958
3235
|
* ```typescript
|
|
2959
3236
|
* // Example usage of zrangeStore to retrieve and store all members of a sorted set in ascending order.
|
|
2960
3237
|
* const result = await client.zrangeStore("destination_key", "my_sorted_set", { start: 0, end: -1 });
|
|
2961
|
-
* console.log(result);
|
|
3238
|
+
* console.log(result);
|
|
3239
|
+
* // Output: 7
|
|
3240
|
+
* // `destination_key` contains a sorted set with the 7 members from `my_sorted_set`.
|
|
2962
3241
|
* ```
|
|
2963
3242
|
* @example
|
|
2964
3243
|
* ```typescript
|
|
2965
|
-
* // Example usage of zrangeStore method to retrieve members within a score range in ascending order and store in
|
|
3244
|
+
* // Example usage of zrangeStore method to retrieve members within a score range in ascending order and store in `destination_key`
|
|
2966
3245
|
* const result = await client.zrangeStore("destination_key", "my_sorted_set", {
|
|
2967
3246
|
* start: InfBoundary.NegativeInfinity,
|
|
2968
3247
|
* end: { value: 3, isInclusive: false },
|
|
2969
3248
|
* type: "byScore",
|
|
2970
3249
|
* });
|
|
2971
|
-
* console.log(result);
|
|
3250
|
+
* console.log(result);
|
|
3251
|
+
* // Output: 5
|
|
3252
|
+
* // Stores 5 members with scores within the range of negative infinity to 3, in ascending order, in `destination_key`.
|
|
2972
3253
|
* ```
|
|
2973
3254
|
*/
|
|
2974
3255
|
zrangeStore(destination: GlideString, source: GlideString, rangeQuery: RangeByScore | RangeByLex | RangeByIndex, reverse?: boolean): Promise<number>;
|
|
@@ -2996,15 +3277,21 @@ export declare class BaseClient {
|
|
|
2996
3277
|
*
|
|
2997
3278
|
* // use `zinterstore` with default aggregation and weights
|
|
2998
3279
|
* console.log(await client.zinterstore("my_sorted_set", ["key1", "key2"]))
|
|
2999
|
-
* // Output: 1
|
|
3280
|
+
* // Output: 1
|
|
3281
|
+
* // Indicates that the sorted set `my_sorted_set` contains one element.
|
|
3282
|
+
*
|
|
3000
3283
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, end: -1}))
|
|
3001
|
-
* // Output: {'member1': 20}
|
|
3284
|
+
* // Output: {'member1': 20}
|
|
3285
|
+
* // `member1` is now stored in `my_sorted_set` with score of 20.
|
|
3002
3286
|
*
|
|
3003
3287
|
* // use `zinterstore` with default weights
|
|
3004
3288
|
* console.log(await client.zinterstore("my_sorted_set", ["key1", "key2"] , { aggregationType: AggregationType.MAX }))
|
|
3005
|
-
* // Output: 1
|
|
3289
|
+
* // Output: 1
|
|
3290
|
+
* // Indicates that the sorted set `my_sorted_set` contains one element, and it's score is the maximum score between the sets.
|
|
3291
|
+
*
|
|
3006
3292
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, end: -1}))
|
|
3007
|
-
* // Output: {'member1': 10.5}
|
|
3293
|
+
* // Output: {'member1': 10.5}
|
|
3294
|
+
* // `member1` is now stored in `my_sorted_set` with score of 10.5.
|
|
3008
3295
|
* ```
|
|
3009
3296
|
*/
|
|
3010
3297
|
zinterstore(destination: GlideString, keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -3030,7 +3317,9 @@ export declare class BaseClient {
|
|
|
3030
3317
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
3031
3318
|
* await client.zadd("key2", {"member1": 9.5});
|
|
3032
3319
|
* const result = await client.zinter(["key1", "key2"]);
|
|
3033
|
-
* console.log(result);
|
|
3320
|
+
* console.log(result);
|
|
3321
|
+
* // Output: ['member1']
|
|
3322
|
+
* // The intersecting element for the sorted sets at `key1` and `key2`.
|
|
3034
3323
|
* ```
|
|
3035
3324
|
*/
|
|
3036
3325
|
zinter(keys: GlideString[], options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -3060,11 +3349,14 @@ export declare class BaseClient {
|
|
|
3060
3349
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
3061
3350
|
* await client.zadd("key2", {"member1": 9.5});
|
|
3062
3351
|
* const result1 = await client.zinterWithScores(["key1", "key2"]);
|
|
3063
|
-
* console.log(result1);
|
|
3064
|
-
* // [{ element: 'member1', score: 20 }]
|
|
3352
|
+
* console.log(result1);
|
|
3353
|
+
* // Output: [{ element: 'member1', score: 20 }]
|
|
3354
|
+
* // `member1` with score of 20 is the result
|
|
3355
|
+
*
|
|
3065
3356
|
* const result2 = await client.zinterWithScores(["key1", "key2"], AggregationType.MAX)
|
|
3066
|
-
* console.log(result2);
|
|
3067
|
-
* // [{ element: 'member1', score: 10.5 }]
|
|
3357
|
+
* console.log(result2);
|
|
3358
|
+
* // Output: [{ element: 'member1', score: 10.5 }]
|
|
3359
|
+
* // `member1` with score of 10.5 is the result
|
|
3068
3360
|
* ```
|
|
3069
3361
|
*/
|
|
3070
3362
|
zinterWithScores(keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -3089,7 +3381,9 @@ export declare class BaseClient {
|
|
|
3089
3381
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
3090
3382
|
* await client.zadd("key2", {"member1": 9.5});
|
|
3091
3383
|
* const result = await client.zunion(["key1", "key2"]);
|
|
3092
|
-
* console.log(result);
|
|
3384
|
+
* console.log(result);
|
|
3385
|
+
* // Output: ['member1', 'member2']
|
|
3386
|
+
* // Union elements from sets stored at keys `key1` and `key2`.
|
|
3093
3387
|
* ```
|
|
3094
3388
|
*/
|
|
3095
3389
|
zunion(keys: GlideString[], options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -3117,11 +3411,14 @@ export declare class BaseClient {
|
|
|
3117
3411
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
3118
3412
|
* await client.zadd("key2", {"member1": 9.5});
|
|
3119
3413
|
* const result1 = await client.zunionWithScores(["key1", "key2"]);
|
|
3120
|
-
* console.log(result1);
|
|
3121
|
-
* // [{ element: 'member1', score: 20 }, { element: 'member2', score: 8.2 }]
|
|
3414
|
+
* console.log(result1);
|
|
3415
|
+
* // Output: [{ element: 'member1', score: 20 }, { element: 'member2', score: 8.2 }]
|
|
3416
|
+
* // A list of union elements with scores.
|
|
3417
|
+
*
|
|
3122
3418
|
* const result2 = await client.zunionWithScores(["key1", "key2"], "MAX");
|
|
3123
|
-
* console.log(result2);
|
|
3124
|
-
* // [{ element: 'member1', score: 10.5}, { element: 'member2', score: 8.2 }]
|
|
3419
|
+
* console.log(result2);
|
|
3420
|
+
* // Output: [{ element: 'member1', score: 10.5}, { element: 'member2', score: 8.2 }]
|
|
3421
|
+
* // A list of union elements with score. The score of the common element in both sets (`member1`), is the maximum of scores(10.5) for that member from both sets.
|
|
3125
3422
|
* ```
|
|
3126
3423
|
*/
|
|
3127
3424
|
zunionWithScores(keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -3140,13 +3437,17 @@ export declare class BaseClient {
|
|
|
3140
3437
|
* @example
|
|
3141
3438
|
* ```typescript
|
|
3142
3439
|
* const payload1 = await client.zrandmember("mySortedSet");
|
|
3143
|
-
* console.log(payload1);
|
|
3440
|
+
* console.log(payload1);
|
|
3441
|
+
* // Output: "Glide"
|
|
3442
|
+
* // A random member from the set
|
|
3144
3443
|
* ```
|
|
3145
3444
|
*
|
|
3146
3445
|
* @example
|
|
3147
3446
|
* ```typescript
|
|
3148
3447
|
* const payload2 = await client.zrandmember("nonExistingSortedSet");
|
|
3149
|
-
* console.log(payload2);
|
|
3448
|
+
* console.log(payload2);
|
|
3449
|
+
* // Output: null
|
|
3450
|
+
* // Since the sorted set does not exist.
|
|
3150
3451
|
* ```
|
|
3151
3452
|
*/
|
|
3152
3453
|
zrandmember(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -3166,13 +3467,17 @@ export declare class BaseClient {
|
|
|
3166
3467
|
* @example
|
|
3167
3468
|
* ```typescript
|
|
3168
3469
|
* const payload1 = await client.zrandmemberWithCount("mySortedSet", -3);
|
|
3169
|
-
* console.log(payload1);
|
|
3470
|
+
* console.log(payload1);
|
|
3471
|
+
* // Output: ["Glide", "GLIDE", "node"]
|
|
3472
|
+
* // Returns 3 random members from the sorted set, with duplicates allowed.
|
|
3170
3473
|
* ```
|
|
3171
3474
|
*
|
|
3172
3475
|
* @example
|
|
3173
3476
|
* ```typescript
|
|
3174
3477
|
* const payload2 = await client.zrandmemberWithCount("nonExistingKey", 3);
|
|
3175
|
-
* console.log(payload1);
|
|
3478
|
+
* console.log(payload1);
|
|
3479
|
+
* // Output: []
|
|
3480
|
+
* // Since the sorted set does not exist.
|
|
3176
3481
|
* ```
|
|
3177
3482
|
*/
|
|
3178
3483
|
zrandmemberWithCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -3192,13 +3497,17 @@ export declare class BaseClient {
|
|
|
3192
3497
|
* @example
|
|
3193
3498
|
* ```typescript
|
|
3194
3499
|
* const payload1 = await client.zrandmemberWithCountWithScore("mySortedSet", -3);
|
|
3195
|
-
* console.log(payload1);
|
|
3500
|
+
* console.log(payload1);
|
|
3501
|
+
* // Output: [["Glide", 1.0], ["GLIDE", 1.0], ["node", 2.0]]
|
|
3502
|
+
* // Returns 3 random members with scores, with duplicates allowed.
|
|
3196
3503
|
* ```
|
|
3197
3504
|
*
|
|
3198
3505
|
* @example
|
|
3199
3506
|
* ```typescript
|
|
3200
3507
|
* const payload2 = await client.zrandmemberWithCountWithScore("nonExistingKey", 3);
|
|
3201
|
-
* console.log(payload1);
|
|
3508
|
+
* console.log(payload1);
|
|
3509
|
+
* // Output: []
|
|
3510
|
+
* // Since the sorted set does not exist.
|
|
3202
3511
|
* ```
|
|
3203
3512
|
*/
|
|
3204
3513
|
zrandmemberWithCountWithScores(key: GlideString, count: number, options?: DecoderOption): Promise<KeyWeight[]>;
|
|
@@ -3215,15 +3524,17 @@ export declare class BaseClient {
|
|
|
3215
3524
|
* ```typescript
|
|
3216
3525
|
* // Example usage of strlen method with an existing key
|
|
3217
3526
|
* await client.set("key", "GLIDE");
|
|
3218
|
-
* const
|
|
3219
|
-
* console.log(
|
|
3527
|
+
* const length1 = await client.strlen("key");
|
|
3528
|
+
* console.log(length1);
|
|
3529
|
+
* // Output: 5
|
|
3220
3530
|
* ```
|
|
3221
3531
|
*
|
|
3222
3532
|
* @example
|
|
3223
3533
|
* ```typescript
|
|
3224
3534
|
* // Example usage of strlen method with a non-existing key
|
|
3225
|
-
* const
|
|
3226
|
-
* console.log(
|
|
3535
|
+
* const length2 = await client.strlen("non_existing_key");
|
|
3536
|
+
* console.log(length2);
|
|
3537
|
+
* // Output: 0
|
|
3227
3538
|
* ```
|
|
3228
3539
|
*/
|
|
3229
3540
|
strlen(key: GlideString): Promise<number>;
|
|
@@ -3240,7 +3551,8 @@ export declare class BaseClient {
|
|
|
3240
3551
|
* // Example usage of type method with a string value
|
|
3241
3552
|
* await client.set("key", "value");
|
|
3242
3553
|
* const type = await client.type("key");
|
|
3243
|
-
* console.log(type);
|
|
3554
|
+
* console.log(type);
|
|
3555
|
+
* // Output: 'string'
|
|
3244
3556
|
* ```
|
|
3245
3557
|
*
|
|
3246
3558
|
* @example
|
|
@@ -3248,7 +3560,8 @@ export declare class BaseClient {
|
|
|
3248
3560
|
* // Example usage of type method with a list
|
|
3249
3561
|
* await client.lpush("key", ["value"]);
|
|
3250
3562
|
* const type = await client.type("key");
|
|
3251
|
-
* console.log(type);
|
|
3563
|
+
* console.log(type);
|
|
3564
|
+
* // Output: 'list'
|
|
3252
3565
|
* ```
|
|
3253
3566
|
*/
|
|
3254
3567
|
type(key: GlideString): Promise<string>;
|
|
@@ -3271,21 +3584,22 @@ export declare class BaseClient {
|
|
|
3271
3584
|
* ```typescript
|
|
3272
3585
|
* // Example usage of zpopmin method to remove and return the member with the lowest score from a sorted set
|
|
3273
3586
|
* const result = await client.zpopmin("my_sorted_set");
|
|
3274
|
-
* console.log(result);
|
|
3275
|
-
* // 'member1'
|
|
3276
|
-
* //
|
|
3587
|
+
* console.log(result);
|
|
3588
|
+
* // Output: [{ element: 'member1', score: 5.0 }]
|
|
3589
|
+
* // `member1` with a score of 5.0 has been removed from the sorted set
|
|
3277
3590
|
* ```
|
|
3278
3591
|
*
|
|
3279
3592
|
* @example
|
|
3280
3593
|
* ```typescript
|
|
3281
3594
|
* // Example usage of zpopmin method to remove and return multiple members with the lowest scores from a sorted set
|
|
3282
3595
|
* const result = await client.zpopmin("my_sorted_set", 2);
|
|
3283
|
-
* console.log(result);
|
|
3284
|
-
* //
|
|
3596
|
+
* console.log(result);
|
|
3597
|
+
* // Output:
|
|
3285
3598
|
* // [
|
|
3286
3599
|
* // { element: 'member3', score: 7.5 },
|
|
3287
3600
|
* // { element: 'member2', score: 8.0 }
|
|
3288
3601
|
* // ]
|
|
3602
|
+
* // `member3` with a score of 7.5 and `member2` with a score of 8.0 have been removed from the sorted set
|
|
3289
3603
|
* ```
|
|
3290
3604
|
*/
|
|
3291
3605
|
zpopmin(key: GlideString, options?: {
|
|
@@ -3310,7 +3624,9 @@ export declare class BaseClient {
|
|
|
3310
3624
|
* @example
|
|
3311
3625
|
* ```typescript
|
|
3312
3626
|
* const data = await client.bzpopmin(["zset1", "zset2"], 0.5);
|
|
3313
|
-
* console.log(data);
|
|
3627
|
+
* console.log(data);
|
|
3628
|
+
* // Output: ["zset1", "a", 2];
|
|
3629
|
+
* // Pops the member `a` with score 2 stored at key `zset1`.
|
|
3314
3630
|
* ```
|
|
3315
3631
|
*/
|
|
3316
3632
|
bzpopmin(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString, number] | null>;
|
|
@@ -3333,21 +3649,22 @@ export declare class BaseClient {
|
|
|
3333
3649
|
* ```typescript
|
|
3334
3650
|
* // Example usage of zpopmax method to remove and return the member with the highest score from a sorted set
|
|
3335
3651
|
* const result = await client.zpopmax("my_sorted_set");
|
|
3336
|
-
* console.log(result);
|
|
3337
|
-
* // 'member1'
|
|
3338
|
-
* //
|
|
3652
|
+
* console.log(result);
|
|
3653
|
+
* // Output: [{ element: 'member1', score: 10.0 }]
|
|
3654
|
+
* // `member1` with a score of 10.0 has been removed from the sorted set
|
|
3339
3655
|
* ```
|
|
3340
3656
|
*
|
|
3341
3657
|
* @example
|
|
3342
3658
|
* ```typescript
|
|
3343
3659
|
* // Example usage of zpopmax method to remove and return multiple members with the highest scores from a sorted set
|
|
3344
3660
|
* const result = await client.zpopmax("my_sorted_set", 2);
|
|
3345
|
-
* console.log(result);
|
|
3346
|
-
* //
|
|
3661
|
+
* console.log(result);
|
|
3662
|
+
* // Output:
|
|
3347
3663
|
* // [
|
|
3348
3664
|
* // { element: 'member3', score: 7.5 },
|
|
3349
3665
|
* // { element: 'member2', score: 8.0 }
|
|
3350
3666
|
* // ]
|
|
3667
|
+
* // `member3` with a score of 7.5 and `member2` with a score of 8.0 have been removed from the sorted set
|
|
3351
3668
|
* ```
|
|
3352
3669
|
*/
|
|
3353
3670
|
zpopmax(key: GlideString, options?: {
|
|
@@ -3372,7 +3689,8 @@ export declare class BaseClient {
|
|
|
3372
3689
|
* @example
|
|
3373
3690
|
* ```typescript
|
|
3374
3691
|
* const data = await client.bzpopmax(["zset1", "zset2"], 0.5);
|
|
3375
|
-
* console.log(data);
|
|
3692
|
+
* console.log(data);
|
|
3693
|
+
* // Output: ["zset1", "c", 2];
|
|
3376
3694
|
* ```
|
|
3377
3695
|
*/
|
|
3378
3696
|
bzpopmax(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString, number] | null>;
|
|
@@ -3388,21 +3706,27 @@ export declare class BaseClient {
|
|
|
3388
3706
|
* ```typescript
|
|
3389
3707
|
* // Example usage of pttl method with an existing key
|
|
3390
3708
|
* const result = await client.pttl("my_key");
|
|
3391
|
-
* console.log(result);
|
|
3709
|
+
* console.log(result);
|
|
3710
|
+
* // Output: 5000
|
|
3711
|
+
* // Indicates that the key `my_key` has a remaining time to live of 5000 milliseconds.
|
|
3392
3712
|
* ```
|
|
3393
3713
|
*
|
|
3394
3714
|
* @example
|
|
3395
3715
|
* ```typescript
|
|
3396
3716
|
* // Example usage of pttl method with a non-existing key
|
|
3397
3717
|
* const result = await client.pttl("non_existing_key");
|
|
3398
|
-
* console.log(result);
|
|
3718
|
+
* console.log(result);
|
|
3719
|
+
* // Output: -2
|
|
3720
|
+
* // Indicates that the key `non_existing_key` does not exist.
|
|
3399
3721
|
* ```
|
|
3400
3722
|
*
|
|
3401
3723
|
* @example
|
|
3402
3724
|
* ```typescript
|
|
3403
3725
|
* // Example usage of pttl method with an exisiting key that has no associated expire.
|
|
3404
3726
|
* const result = await client.pttl("key");
|
|
3405
|
-
* console.log(result);
|
|
3727
|
+
* console.log(result);
|
|
3728
|
+
* // Output: -1
|
|
3729
|
+
* // Indicates that the key `key` has no associated expire.
|
|
3406
3730
|
* ```
|
|
3407
3731
|
*/
|
|
3408
3732
|
pttl(key: GlideString): Promise<number>;
|
|
@@ -3425,7 +3749,9 @@ export declare class BaseClient {
|
|
|
3425
3749
|
* ```typescript
|
|
3426
3750
|
* // Example usage of zremRangeByRank method
|
|
3427
3751
|
* const result = await client.zremRangeByRank("my_sorted_set", 0, 2);
|
|
3428
|
-
* console.log(result);
|
|
3752
|
+
* console.log(result);
|
|
3753
|
+
* // Output: 3
|
|
3754
|
+
* // Indicates that three elements have been removed from the sorted set `my_sorted_set` between ranks 0 and 2.
|
|
3429
3755
|
* ```
|
|
3430
3756
|
*/
|
|
3431
3757
|
zremRangeByRank(key: GlideString, start: number, end: number): Promise<number>;
|
|
@@ -3445,14 +3771,18 @@ export declare class BaseClient {
|
|
|
3445
3771
|
* ```typescript
|
|
3446
3772
|
* // Example usage of zremRangeByLex method to remove members from a sorted set based on lexicographical order range
|
|
3447
3773
|
* const result = await client.zremRangeByLex("my_sorted_set", { value: "a", isInclusive: false }, { value: "e" });
|
|
3448
|
-
* console.log(result);
|
|
3774
|
+
* console.log(result);
|
|
3775
|
+
* // Output: 4
|
|
3776
|
+
* // Indicates that 4 members, with lexicographical values ranging from `a` (exclusive) to `e` (inclusive), have been removed from `my_sorted_set`.
|
|
3449
3777
|
* ```
|
|
3450
3778
|
*
|
|
3451
3779
|
* @example
|
|
3452
3780
|
* ```typescript
|
|
3453
3781
|
* // Example usage of zremRangeByLex method when the sorted set does not exist
|
|
3454
3782
|
* const result = await client.zremRangeByLex("non_existing_sorted_set", InfBoundary.NegativeInfinity, { value: "e" });
|
|
3455
|
-
* console.log(result);
|
|
3783
|
+
* console.log(result);
|
|
3784
|
+
* // Output: 0
|
|
3785
|
+
* // Indicates that no elements were removed.
|
|
3456
3786
|
* ```
|
|
3457
3787
|
*/
|
|
3458
3788
|
zremRangeByLex(key: GlideString, minLex: Boundary<GlideString>, maxLex: Boundary<GlideString>): Promise<number>;
|
|
@@ -3472,14 +3802,18 @@ export declare class BaseClient {
|
|
|
3472
3802
|
* ```typescript
|
|
3473
3803
|
* // Example usage of zremRangeByScore method to remove members from a sorted set based on score range
|
|
3474
3804
|
* const result = await client.zremRangeByScore("my_sorted_set", { value: 5.0, isInclusive: true }, InfBoundary.PositiveInfinity);
|
|
3475
|
-
* console.log(result);
|
|
3805
|
+
* console.log(result);
|
|
3806
|
+
* // Output: 2
|
|
3807
|
+
* // Indicates that 2 members with scores between 5.0 (inclusive) and +inf have been removed from the sorted set `my_sorted_set`.
|
|
3476
3808
|
* ```
|
|
3477
3809
|
*
|
|
3478
3810
|
* @example
|
|
3479
3811
|
* ```typescript
|
|
3480
3812
|
* // Example usage of zremRangeByScore method when the sorted set does not exist
|
|
3481
3813
|
* const result = await client.zremRangeByScore("non_existing_sorted_set", { value: 5.0, isInclusive: true }, { value: 10.0, isInclusive: false });
|
|
3482
|
-
* console.log(result);
|
|
3814
|
+
* console.log(result);
|
|
3815
|
+
* // Output: 0
|
|
3816
|
+
* // Indicates that no members were removed as the sorted set `non_existing_sorted_set` does not exist.
|
|
3483
3817
|
* ```
|
|
3484
3818
|
*/
|
|
3485
3819
|
zremRangeByScore(key: GlideString, minScore: Boundary<number>, maxScore: Boundary<number>): Promise<number>;
|
|
@@ -3498,13 +3832,17 @@ export declare class BaseClient {
|
|
|
3498
3832
|
* @example
|
|
3499
3833
|
* ```typescript
|
|
3500
3834
|
* const result = await client.zlexcount("my_sorted_set", {value: "c"}, InfBoundary.PositiveInfinity);
|
|
3501
|
-
* console.log(result);
|
|
3835
|
+
* console.log(result);
|
|
3836
|
+
* // Output: 2
|
|
3837
|
+
* // Indicates that there are 2 members with lex scores between `c` (inclusive) and positive infinity in the sorted set `my_sorted_set`.
|
|
3502
3838
|
* ```
|
|
3503
3839
|
*
|
|
3504
3840
|
* @example
|
|
3505
3841
|
* ```typescript
|
|
3506
3842
|
* const result = await client.zlexcount("my_sorted_set", {value: "c"}, {value: "k", isInclusive: false});
|
|
3507
|
-
* console.log(result);
|
|
3843
|
+
* console.log(result);
|
|
3844
|
+
* // Output: 1
|
|
3845
|
+
* // Indicates that there is one member with a lex score between `c` (inclusive) and `k` (exclusive) in the sorted set `my_sorted_set`.
|
|
3508
3846
|
* ```
|
|
3509
3847
|
*/
|
|
3510
3848
|
zlexcount(key: GlideString, minLex: Boundary<GlideString>, maxLex: Boundary<GlideString>): Promise<number>;
|
|
@@ -3523,14 +3861,18 @@ export declare class BaseClient {
|
|
|
3523
3861
|
* ```typescript
|
|
3524
3862
|
* // Example usage of zrank method to retrieve the rank of a member in a sorted set
|
|
3525
3863
|
* const result = await client.zrank("my_sorted_set", "member2");
|
|
3526
|
-
* console.log(result);
|
|
3864
|
+
* console.log(result);
|
|
3865
|
+
* // Output: 1
|
|
3866
|
+
* // Indicates that `member2` has the second-lowest score in the sorted set `my_sorted_set`.
|
|
3527
3867
|
* ```
|
|
3528
3868
|
*
|
|
3529
3869
|
* @example
|
|
3530
3870
|
* ```typescript
|
|
3531
3871
|
* // Example usage of zrank method with a non-existing member
|
|
3532
3872
|
* const result = await client.zrank("my_sorted_set", "non_existing_member");
|
|
3533
|
-
* console.log(result);
|
|
3873
|
+
* console.log(result);
|
|
3874
|
+
* // Output: null
|
|
3875
|
+
* // Indicates that `non_existing_member` is not present in the sorted set `my_sorted_set`.
|
|
3534
3876
|
* ```
|
|
3535
3877
|
*/
|
|
3536
3878
|
zrank(key: GlideString, member: GlideString): Promise<number | null>;
|
|
@@ -3549,14 +3891,18 @@ export declare class BaseClient {
|
|
|
3549
3891
|
* ```typescript
|
|
3550
3892
|
* // Example usage of zrank_withscore method to retrieve the rank and score of a member in a sorted set
|
|
3551
3893
|
* const result = await client.zrank_withscore("my_sorted_set", "member2");
|
|
3552
|
-
* console.log(result);
|
|
3894
|
+
* console.log(result);
|
|
3895
|
+
* // Output: [1, 6.0]
|
|
3896
|
+
* // Indicates that `member2` with score 6.0 has the second-lowest score in the sorted set `my_sorted_set`.
|
|
3553
3897
|
* ```
|
|
3554
3898
|
*
|
|
3555
3899
|
* @example
|
|
3556
3900
|
* ```typescript
|
|
3557
3901
|
* // Example usage of zrank_withscore method with a non-existing member
|
|
3558
3902
|
* const result = await client.zrank_withscore("my_sorted_set", "non_existing_member");
|
|
3559
|
-
* console.log(result);
|
|
3903
|
+
* console.log(result);
|
|
3904
|
+
* // Output: null
|
|
3905
|
+
* // Indicates that `non_existing_member` is not present in the sorted set `my_sorted_set`.
|
|
3560
3906
|
* ```
|
|
3561
3907
|
*/
|
|
3562
3908
|
zrankWithScore(key: GlideString, member: GlideString): Promise<[number, number] | null>;
|
|
@@ -3575,7 +3921,9 @@ export declare class BaseClient {
|
|
|
3575
3921
|
* @example
|
|
3576
3922
|
* ```typescript
|
|
3577
3923
|
* const result = await client.zrevrank("my_sorted_set", "member2");
|
|
3578
|
-
* console.log(result);
|
|
3924
|
+
* console.log(result);
|
|
3925
|
+
* // Output: 1
|
|
3926
|
+
* // Indicates that `member2` has the second-highest score in the sorted set `my_sorted_set`.
|
|
3579
3927
|
* ```
|
|
3580
3928
|
*/
|
|
3581
3929
|
zrevrank(key: GlideString, member: GlideString): Promise<number | null>;
|
|
@@ -3595,7 +3943,9 @@ export declare class BaseClient {
|
|
|
3595
3943
|
* @example
|
|
3596
3944
|
* ```typescript
|
|
3597
3945
|
* const result = await client.zrevankWithScore("my_sorted_set", "member2");
|
|
3598
|
-
* console.log(result);
|
|
3946
|
+
* console.log(result);
|
|
3947
|
+
* // Output: [1, 6.0]
|
|
3948
|
+
* // Indicates that `member2` with score 6.0 has the second-highest score in the sorted set `my_sorted_set`.
|
|
3599
3949
|
* ```
|
|
3600
3950
|
*/
|
|
3601
3951
|
zrevrankWithScore(key: GlideString, member: GlideString): Promise<[number, number] | null>;
|
|
@@ -3624,7 +3974,8 @@ export declare class BaseClient {
|
|
|
3624
3974
|
* @example
|
|
3625
3975
|
* ```typescript
|
|
3626
3976
|
* console.log(await client.xdel("key", ["1538561698944-0", "1538561698944-1"]));
|
|
3627
|
-
* // Output
|
|
3977
|
+
* // Output: 2
|
|
3978
|
+
* // the stream marked 2 entries as deleted.
|
|
3628
3979
|
* ```
|
|
3629
3980
|
*/
|
|
3630
3981
|
xdel(key: GlideString, ids: string[]): Promise<number>;
|
|
@@ -3650,12 +4001,13 @@ export declare class BaseClient {
|
|
|
3650
4001
|
* @example
|
|
3651
4002
|
* ```typescript
|
|
3652
4003
|
* const streamResults = await client.xread({"my_stream": "0-0", "writers": "0-0"});
|
|
3653
|
-
* console.log(result);
|
|
4004
|
+
* console.log(result);
|
|
4005
|
+
* // Output:
|
|
3654
4006
|
* // [
|
|
3655
4007
|
* // {
|
|
3656
|
-
* // key: "my_stream",
|
|
3657
|
-
* // value: {
|
|
3658
|
-
* // "1526984818136-0": [["duration", "1532"], ["event-id", "5"], ["user-id", "7782813"]],
|
|
4008
|
+
* // key: "my_stream", // Stream key
|
|
4009
|
+
* // value: { // Stream Ids mapped to entries array.
|
|
4010
|
+
* // "1526984818136-0": [["duration", "1532"], ["event-id", "5"], ["user-id", "7782813"]], // Each entry is a key/value tuple.
|
|
3659
4011
|
* // "1526999352406-0": [["duration", "812"], ["event-id", "9"], ["user-id", "388234"]],
|
|
3660
4012
|
* // }
|
|
3661
4013
|
* // },
|
|
@@ -3686,7 +4038,8 @@ export declare class BaseClient {
|
|
|
3686
4038
|
* @example
|
|
3687
4039
|
* ```typescript
|
|
3688
4040
|
* const streamResults = await client.xreadgroup("my_group", "my_consumer", {"my_stream": "0-0", "writers_stream": "0-0", "readers_stream", ">"});
|
|
3689
|
-
* console.log(result);
|
|
4041
|
+
* console.log(result);
|
|
4042
|
+
* // Output:
|
|
3690
4043
|
* // [
|
|
3691
4044
|
* // {
|
|
3692
4045
|
* // key: "my_stream",
|
|
@@ -3721,7 +4074,9 @@ export declare class BaseClient {
|
|
|
3721
4074
|
* @example
|
|
3722
4075
|
* ```typescript
|
|
3723
4076
|
* const numEntries = await client.xlen("my_stream");
|
|
3724
|
-
* console.log(numEntries);
|
|
4077
|
+
* console.log(numEntries);
|
|
4078
|
+
* // Output: 2
|
|
4079
|
+
* // `my_stream` contains 2 entries.
|
|
3725
4080
|
* ```
|
|
3726
4081
|
*/
|
|
3727
4082
|
xlen(key: GlideString): Promise<number>;
|
|
@@ -3735,7 +4090,8 @@ export declare class BaseClient {
|
|
|
3735
4090
|
* @returns An `array` that includes the summary of the pending messages. See example for more details.
|
|
3736
4091
|
* @example
|
|
3737
4092
|
* ```typescript
|
|
3738
|
-
* console.log(await client.xpending("my_stream", "my_group"));
|
|
4093
|
+
* console.log(await client.xpending("my_stream", "my_group"));
|
|
4094
|
+
* // Output:
|
|
3739
4095
|
* // [
|
|
3740
4096
|
* // 42, // The total number of pending messages
|
|
3741
4097
|
* // "1722643465939-0", // The smallest ID among the pending messages
|
|
@@ -3765,7 +4121,8 @@ export declare class BaseClient {
|
|
|
3765
4121
|
* end: InfBoundary.PositiveInfinity,
|
|
3766
4122
|
* count: 2,
|
|
3767
4123
|
* consumer: "consumer1"
|
|
3768
|
-
* });
|
|
4124
|
+
* });
|
|
4125
|
+
* // Output:
|
|
3769
4126
|
* // [
|
|
3770
4127
|
* // [
|
|
3771
4128
|
* // "1722643465939-0", // The ID of the message
|
|
@@ -3798,13 +4155,14 @@ export declare class BaseClient {
|
|
|
3798
4155
|
* @example
|
|
3799
4156
|
* ```typescript
|
|
3800
4157
|
* const result = await client.xinfoConsumers("my_stream", "my_group");
|
|
3801
|
-
* console.log(result);
|
|
4158
|
+
* console.log(result);
|
|
4159
|
+
* // Output:
|
|
3802
4160
|
* // [
|
|
3803
4161
|
* // {
|
|
3804
|
-
* // "name": "Alice",
|
|
3805
|
-
* // "pending": 1,
|
|
3806
|
-
* // "idle": 9104628,
|
|
3807
|
-
* // "inactive": 18104698
|
|
4162
|
+
* // "name": "Alice", // The consumer name.
|
|
4163
|
+
* // "pending": 1, // The number of entries in Pending entries list.
|
|
4164
|
+
* // "idle": 9104628, // The time passed since last attempted interaction.
|
|
4165
|
+
* // "inactive": 18104698 // The time passed since last successful interaction. Added in Valkey 7.2.0.
|
|
3808
4166
|
* // },
|
|
3809
4167
|
* // ...
|
|
3810
4168
|
* // ]
|
|
@@ -3823,23 +4181,24 @@ export declare class BaseClient {
|
|
|
3823
4181
|
* @example
|
|
3824
4182
|
* ```typescript
|
|
3825
4183
|
* const result = await client.xinfoGroups("my_stream");
|
|
3826
|
-
* console.log(result);
|
|
4184
|
+
* console.log(result);
|
|
4185
|
+
* // Output:
|
|
3827
4186
|
* // [
|
|
3828
4187
|
* // {
|
|
3829
|
-
* // "name": "mygroup",
|
|
3830
|
-
* // "consumers": 2,
|
|
3831
|
-
* // "pending": 2,
|
|
3832
|
-
* // "last-delivered-id": "1638126030001-0",
|
|
3833
|
-
* // "entries-read": 2,
|
|
3834
|
-
* // "lag": 0
|
|
4188
|
+
* // "name": "mygroup", // The consumer group name.
|
|
4189
|
+
* // "consumers": 2, // Number of consumers in the group.
|
|
4190
|
+
* // "pending": 2, // The length of the group's pending entry list.
|
|
4191
|
+
* // "last-delivered-id": "1638126030001-0", // The id of the last delivered entry to the consumers.
|
|
4192
|
+
* // "entries-read": 2, // The read counter. Added in Valkey 7.0.0.
|
|
4193
|
+
* // "lag": 0 // The number of entries that are still waiting to be delivered. Added in Valkey 7.0.0.
|
|
3835
4194
|
* // },
|
|
3836
4195
|
* // {
|
|
3837
4196
|
* // "name": "some-other-group",
|
|
3838
4197
|
* // "consumers": 1,
|
|
3839
4198
|
* // "pending": 0,
|
|
3840
4199
|
* // "last-delivered-id": "0-0",
|
|
3841
|
-
* // "entries-read": null, // Added in
|
|
3842
|
-
* // "lag": 1 // Added in
|
|
4200
|
+
* // "entries-read": null, // Added in Valkey 7.0.0.
|
|
4201
|
+
* // "lag": 1 // Added in Valkey 7.0.0.
|
|
3843
4202
|
* // }
|
|
3844
4203
|
* // ]
|
|
3845
4204
|
* ```
|
|
@@ -3862,9 +4221,14 @@ export declare class BaseClient {
|
|
|
3862
4221
|
* ```typescript
|
|
3863
4222
|
* const result = await client.xclaim("myStream", "myGroup", "myConsumer", 42,
|
|
3864
4223
|
* ["1-0", "2-0", "3-0"], { idle: 500, retryCount: 3, isForce: true });
|
|
3865
|
-
* console.log(result);
|
|
4224
|
+
* console.log(result);
|
|
4225
|
+
* // Output:
|
|
3866
4226
|
* // {
|
|
3867
|
-
* // "2-0": [
|
|
4227
|
+
* // "2-0": [ // Stream Entry id
|
|
4228
|
+
* // ["duration", "1532"], // Entry data tuple containing the field and associated value.
|
|
4229
|
+
* // ["event-id", "5"],
|
|
4230
|
+
* // ["user-id", "7782813"]
|
|
4231
|
+
* // ]
|
|
3868
4232
|
* // }
|
|
3869
4233
|
* ```
|
|
3870
4234
|
*/
|
|
@@ -3896,7 +4260,8 @@ export declare class BaseClient {
|
|
|
3896
4260
|
* @example
|
|
3897
4261
|
* ```typescript
|
|
3898
4262
|
* const result = await client.xautoclaim("myStream", "myGroup", "myConsumer", 42, "0-0", { count: 25 });
|
|
3899
|
-
* console.log(result);
|
|
4263
|
+
* console.log(result);
|
|
4264
|
+
* // Output:
|
|
3900
4265
|
* // [
|
|
3901
4266
|
* // "1609338788321-0", // value to be used as `start` argument
|
|
3902
4267
|
* // // for the next `xautoclaim` call
|
|
@@ -3942,7 +4307,8 @@ export declare class BaseClient {
|
|
|
3942
4307
|
* @example
|
|
3943
4308
|
* ```typescript
|
|
3944
4309
|
* const result = await client.xautoclaim("myStream", "myGroup", "myConsumer", 42, "0-0", { count: 25 });
|
|
3945
|
-
* console.log(result);
|
|
4310
|
+
* console.log(result);
|
|
4311
|
+
* // Output:
|
|
3946
4312
|
* // [
|
|
3947
4313
|
* // "1609338788321-0", // value to be used as `start` argument
|
|
3948
4314
|
* // // for the next `xautoclaim` call
|
|
@@ -3978,7 +4344,9 @@ export declare class BaseClient {
|
|
|
3978
4344
|
* ```typescript
|
|
3979
4345
|
* const result = await client.xclaimJustId("my_stream", "my_group", "my_consumer", 42,
|
|
3980
4346
|
* ["1-0", "2-0", "3-0"], { idle: 500, retryCount: 3, isForce: true });
|
|
3981
|
-
* console.log(result);
|
|
4347
|
+
* console.log(result);
|
|
4348
|
+
* // Output: [ "2-0", "3-0" ]
|
|
4349
|
+
* // A list of entry ids.
|
|
3982
4350
|
* ```
|
|
3983
4351
|
*/
|
|
3984
4352
|
xclaimJustId(key: GlideString, group: GlideString, consumer: GlideString, minIdleTime: number, ids: string[], options?: StreamClaimOptions): Promise<string[]>;
|
|
@@ -3996,7 +4364,8 @@ export declare class BaseClient {
|
|
|
3996
4364
|
* @example
|
|
3997
4365
|
* ```typescript
|
|
3998
4366
|
* // Create the consumer group "mygroup", using zero as the starting ID:
|
|
3999
|
-
* console.log(await client.xgroupCreate("mystream", "mygroup", "0-0"));
|
|
4367
|
+
* console.log(await client.xgroupCreate("mystream", "mygroup", "0-0"));
|
|
4368
|
+
* // Output: "OK"
|
|
4000
4369
|
* ```
|
|
4001
4370
|
*/
|
|
4002
4371
|
xgroupCreate(key: GlideString, groupName: GlideString, id: string, options?: StreamGroupOptions): Promise<"OK">;
|
|
@@ -4012,7 +4381,8 @@ export declare class BaseClient {
|
|
|
4012
4381
|
* @example
|
|
4013
4382
|
* ```typescript
|
|
4014
4383
|
* // Destroys the consumer group "mygroup"
|
|
4015
|
-
* console.log(await client.xgroupDestroy("mystream", "mygroup"));
|
|
4384
|
+
* console.log(await client.xgroupDestroy("mystream", "mygroup"));
|
|
4385
|
+
* // Output: true
|
|
4016
4386
|
* ```
|
|
4017
4387
|
*/
|
|
4018
4388
|
xgroupDestroy(key: GlideString, groupName: GlideString): Promise<boolean>;
|
|
@@ -4026,6 +4396,7 @@ export declare class BaseClient {
|
|
|
4026
4396
|
* - (Optional) `fullOptions`: If `true`, returns verbose information with a limit of the first 10 PEL entries.
|
|
4027
4397
|
* If `number` is specified, returns verbose information limiting the returned PEL entries.
|
|
4028
4398
|
* If `0` is specified, returns verbose information with no limit.
|
|
4399
|
+
* @remark `fullOptions` - Available since Valkey version 6.0.0
|
|
4029
4400
|
* - (Optional) `decoder`: see {@link DecoderOption}.
|
|
4030
4401
|
* @returns A {@link ReturnTypeXinfoStream} of detailed stream information for the given `key`. See
|
|
4031
4402
|
* the example for a sample response.
|
|
@@ -4035,46 +4406,46 @@ export declare class BaseClient {
|
|
|
4035
4406
|
* const infoResult = await client.xinfoStream("my_stream");
|
|
4036
4407
|
* console.log(infoResult);
|
|
4037
4408
|
* // Output: {
|
|
4038
|
-
* // length: 2,
|
|
4039
|
-
* // "radix-tree-keys": 1,
|
|
4040
|
-
* // "radix-tree-nodes": 2,
|
|
4041
|
-
* // "last-generated-id": "1719877599564-1",
|
|
4042
|
-
* // "max-deleted-entry-id": "0-0",
|
|
4043
|
-
* // "entries-added": 2,
|
|
4044
|
-
* // "recorded-first-entry-id": "1719877599564-0",
|
|
4045
|
-
* // "first-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
|
|
4046
|
-
* // "last-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
|
|
4047
|
-
* // groups: 1,
|
|
4409
|
+
* // length: 2, // The number of entries in the stream.
|
|
4410
|
+
* // "radix-tree-keys": 1, // The number of keys in the underlying radix data structure.
|
|
4411
|
+
* // "radix-tree-nodes": 2, // The number of nodes in the underlying radix data structure.
|
|
4412
|
+
* // "last-generated-id": "1719877599564-1", // The ID of the least-recently entry that was added to the stream.
|
|
4413
|
+
* // "max-deleted-entry-id": "0-0", // The maximal entry ID that was deleted from the stream. Added in Valkey 7.0.0.
|
|
4414
|
+
* // "entries-added": 2, // The count of all entries added to the stream during its lifetime. Added in Valkey 7.0.0.
|
|
4415
|
+
* // "recorded-first-entry-id": "1719877599564-0", // Recorded first entry id. Added in Valkey 7.0.0.
|
|
4416
|
+
* // "first-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ], // The ID and field-value tuples of the first entry in the stream.
|
|
4417
|
+
* // "last-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ], // The ID and field-value tuples of the last entry in the stream.
|
|
4418
|
+
* // "groups": 1, // The number of consumer groups defined for the stream
|
|
4048
4419
|
* // }
|
|
4049
4420
|
* ```
|
|
4050
4421
|
*
|
|
4051
4422
|
* @example
|
|
4052
4423
|
* ```typescript
|
|
4053
4424
|
* const infoResult = await client.xinfoStream("my_stream", true); // default limit of 10 entries
|
|
4054
|
-
* const infoResult = await client.xinfoStream("my_stream", 15);
|
|
4425
|
+
* const infoResult = await client.xinfoStream("my_stream", 15); // limit of 15 entries
|
|
4055
4426
|
* console.log(infoResult);
|
|
4056
4427
|
* // Output: {
|
|
4057
|
-
* // "length": 2,
|
|
4058
|
-
* // "radix-tree-keys": 1,
|
|
4059
|
-
* // "radix-tree-nodes": 2,
|
|
4060
|
-
* // "last-generated-id": "1719877599564-1",
|
|
4061
|
-
* // "max-deleted-entry-id": "0-0",
|
|
4062
|
-
* // "entries-added": 2,
|
|
4063
|
-
* // "recorded-first-entry-id": "1719877599564-0",
|
|
4064
|
-
* // "entries": [ [ "1719877599564-0", ["some_field", "some_value", ...] ] ],
|
|
4065
|
-
* // "groups': [ {
|
|
4066
|
-
* // "name': "group",
|
|
4067
|
-
* // "last-delivered-id": "1719877599564-0",
|
|
4068
|
-
* // "entries-read": 1,
|
|
4069
|
-
* // "lag": 1,
|
|
4070
|
-
* // "pel-count": 1,
|
|
4071
|
-
* // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ],
|
|
4428
|
+
* // "length": 2, // The number of entries in the stream.
|
|
4429
|
+
* // "radix-tree-keys": 1, // The number of keys in the underlying radix data structure.
|
|
4430
|
+
* // "radix-tree-nodes": 2, // The number of nodes in the underlying radix data structure.
|
|
4431
|
+
* // "last-generated-id": "1719877599564-1", // The ID of the least-recently entry that was added to the stream.
|
|
4432
|
+
* // "max-deleted-entry-id": "0-0", // The maximal entry ID that was deleted from the stream. Added in Valkey 7.0.0.
|
|
4433
|
+
* // "entries-added": 2, // The count of all entries added to the stream during its lifetime. Added in Valkey 7.0.0.
|
|
4434
|
+
* // "recorded-first-entry-id": "1719877599564-0", // Recorded first entry id. Added in Valkey 7.0.0.
|
|
4435
|
+
* // "entries": [ [ "1719877599564-0", ["some_field", "some_value", ...] ] ], // Array of the stream entries (ID and field-value tuples) in ascending order.
|
|
4436
|
+
* // "groups': [ { // An array of groups containing information about each consumer group.
|
|
4437
|
+
* // "name': "group", // The consumer group's name.
|
|
4438
|
+
* // "last-delivered-id": "1719877599564-0", // The ID of the last entry delivered to the group's consumers.
|
|
4439
|
+
* // "entries-read": 1, // The logical "read counter" of the last entry delivered to the group's consumers. Added in Valkey 7.0.0.
|
|
4440
|
+
* // "lag": 1, // The number of entries in the stream that are still waiting to be delivered. Added in Valkey 7.0.0.
|
|
4441
|
+
* // "pel-count": 1, // The length of the group's pending entries list (PEL).
|
|
4442
|
+
* // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ], // An array with pending entries.
|
|
4072
4443
|
* // "consumers": [ {
|
|
4073
|
-
* // "name": "consumer",
|
|
4074
|
-
* // "seen-time": 1722624726802,
|
|
4075
|
-
* // "active-time": 1722624726802,
|
|
4076
|
-
* // "pel-count": 1,
|
|
4077
|
-
* // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ],
|
|
4444
|
+
* // "name": "consumer", // The consumer's name.
|
|
4445
|
+
* // "seen-time": 1722624726802, // The UNIX timestamp of the last attempted interaction.
|
|
4446
|
+
* // "active-time": 1722624726802, // The UNIX timestamp of the last successful interaction. Added in Valkey 7.2.0.
|
|
4447
|
+
* // "pel-count": 1, // The number of entries in the PEL.
|
|
4448
|
+
* // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ], // An array with pending entries information.
|
|
4078
4449
|
* // }
|
|
4079
4450
|
* // ]
|
|
4080
4451
|
* // }
|
|
@@ -4098,7 +4469,8 @@ export declare class BaseClient {
|
|
|
4098
4469
|
* @example
|
|
4099
4470
|
* ```typescript
|
|
4100
4471
|
* // The consumer "myconsumer" was created in consumer group "mygroup" for the stream "mystream".
|
|
4101
|
-
* console.log(await client.xgroupCreateConsumer("mystream", "mygroup", "myconsumer"));
|
|
4472
|
+
* console.log(await client.xgroupCreateConsumer("mystream", "mygroup", "myconsumer"));
|
|
4473
|
+
* // Output: true
|
|
4102
4474
|
* ```
|
|
4103
4475
|
*/
|
|
4104
4476
|
xgroupCreateConsumer(key: GlideString, groupName: GlideString, consumerName: GlideString): Promise<boolean>;
|
|
@@ -4115,7 +4487,8 @@ export declare class BaseClient {
|
|
|
4115
4487
|
* * @example
|
|
4116
4488
|
* ```typescript
|
|
4117
4489
|
* // Consumer "myconsumer" was deleted, and had 5 pending messages unclaimed.
|
|
4118
|
-
* console.log(await client.xgroupDelConsumer("mystream", "mygroup", "myconsumer"));
|
|
4490
|
+
* console.log(await client.xgroupDelConsumer("mystream", "mygroup", "myconsumer"));
|
|
4491
|
+
* // Output: 5
|
|
4119
4492
|
* ```
|
|
4120
4493
|
*/
|
|
4121
4494
|
xgroupDelConsumer(key: GlideString, groupName: GlideString, consumerName: GlideString): Promise<number>;
|
|
@@ -4137,7 +4510,8 @@ export declare class BaseClient {
|
|
|
4137
4510
|
* // read messages from streamId
|
|
4138
4511
|
* const readResult = await client.xreadgroup(["myfield", "mydata"], "mygroup", "my0consumer");
|
|
4139
4512
|
* // acknowledge messages on stream
|
|
4140
|
-
* console.log(await client.xack("mystream", "mygroup", [entryId]));
|
|
4513
|
+
* console.log(await client.xack("mystream", "mygroup", [entryId]));
|
|
4514
|
+
* // Output: 1
|
|
4141
4515
|
* ```
|
|
4142
4516
|
*/
|
|
4143
4517
|
xack(key: GlideString, group: GlideString, ids: string[]): Promise<number>;
|
|
@@ -4156,7 +4530,8 @@ export declare class BaseClient {
|
|
|
4156
4530
|
*
|
|
4157
4531
|
* * @example
|
|
4158
4532
|
* ```typescript
|
|
4159
|
-
* console.log(await client.xgroupSetId("mystream", "mygroup", "0", { entriesRead: 1 }));
|
|
4533
|
+
* console.log(await client.xgroupSetId("mystream", "mygroup", "0", { entriesRead: 1 }));
|
|
4534
|
+
* // Output: "OK"
|
|
4160
4535
|
* ```
|
|
4161
4536
|
*/
|
|
4162
4537
|
xgroupSetId(key: GlideString, groupName: GlideString, id: string, options?: {
|
|
@@ -4179,14 +4554,18 @@ export declare class BaseClient {
|
|
|
4179
4554
|
* ```typescript
|
|
4180
4555
|
* // Example usage of lindex method to retrieve elements from a list by index
|
|
4181
4556
|
* const result = await client.lindex("my_list", 0);
|
|
4182
|
-
* console.log(result);
|
|
4557
|
+
* console.log(result);
|
|
4558
|
+
* // Output: 'value1'
|
|
4559
|
+
* // Returns the first element in the list stored at `my_list`.
|
|
4183
4560
|
* ```
|
|
4184
4561
|
*
|
|
4185
4562
|
* @example
|
|
4186
4563
|
* ```typescript
|
|
4187
4564
|
* // Example usage of lindex method to retrieve elements from a list by negative index
|
|
4188
4565
|
* const result = await client.lindex("my_list", -1);
|
|
4189
|
-
* console.log(result);
|
|
4566
|
+
* console.log(result);
|
|
4567
|
+
* // Output: 'value3'
|
|
4568
|
+
* // Returns the last element in the list stored at `my_list`.
|
|
4190
4569
|
* ```
|
|
4191
4570
|
*/
|
|
4192
4571
|
lindex(key: GlideString, index: number, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -4207,7 +4586,9 @@ export declare class BaseClient {
|
|
|
4207
4586
|
* @example
|
|
4208
4587
|
* ```typescript
|
|
4209
4588
|
* const length = await client.linsert("my_list", InsertPosition.Before, "World", "There");
|
|
4210
|
-
* console.log(length);
|
|
4589
|
+
* console.log(length);
|
|
4590
|
+
* // Output: 2
|
|
4591
|
+
* // The list has a length of 2 after performing the insert.
|
|
4211
4592
|
* ```
|
|
4212
4593
|
*/
|
|
4213
4594
|
linsert(key: GlideString, position: InsertPosition, pivot: GlideString, element: GlideString): Promise<number>;
|
|
@@ -4224,7 +4605,9 @@ export declare class BaseClient {
|
|
|
4224
4605
|
* ```typescript
|
|
4225
4606
|
* // Example usage of persist method to remove the timeout associated with a key
|
|
4226
4607
|
* const result = await client.persist("my_key");
|
|
4227
|
-
* console.log(result);
|
|
4608
|
+
* console.log(result);
|
|
4609
|
+
* // Output: true
|
|
4610
|
+
* // Indicates that the timeout associated with the key `my_key` was successfully removed.
|
|
4228
4611
|
* ```
|
|
4229
4612
|
*/
|
|
4230
4613
|
persist(key: GlideString): Promise<boolean>;
|
|
@@ -4244,7 +4627,9 @@ export declare class BaseClient {
|
|
|
4244
4627
|
* // Example usage of rename method to rename a key
|
|
4245
4628
|
* await client.set("old_key", "value");
|
|
4246
4629
|
* const result = await client.rename("old_key", "new_key");
|
|
4247
|
-
* console.log(result);
|
|
4630
|
+
* console.log(result);
|
|
4631
|
+
* // Output: OK
|
|
4632
|
+
* // Indicates successful renaming of the key `old_key` to `new_key`.
|
|
4248
4633
|
* ```
|
|
4249
4634
|
*/
|
|
4250
4635
|
rename(key: GlideString, newKey: GlideString): Promise<"OK">;
|
|
@@ -4264,7 +4649,9 @@ export declare class BaseClient {
|
|
|
4264
4649
|
* // Example usage of renamenx method to rename a key
|
|
4265
4650
|
* await client.set("old_key", "value");
|
|
4266
4651
|
* const result = await client.renamenx("old_key", "new_key");
|
|
4267
|
-
* console.log(result);
|
|
4652
|
+
* console.log(result);
|
|
4653
|
+
* // Output: true
|
|
4654
|
+
* // Indicates successful renaming of the key `old_key` to `new_key`.
|
|
4268
4655
|
* ```
|
|
4269
4656
|
*/
|
|
4270
4657
|
renamenx(key: GlideString, newKey: GlideString): Promise<boolean>;
|
|
@@ -4287,7 +4674,9 @@ export declare class BaseClient {
|
|
|
4287
4674
|
* ```typescript
|
|
4288
4675
|
* // Example usage of brpop method to block and wait for elements from multiple lists
|
|
4289
4676
|
* const result = await client.brpop(["list1", "list2"], 5);
|
|
4290
|
-
* console.log(result);
|
|
4677
|
+
* console.log(result);
|
|
4678
|
+
* // Output: ["list1", "element"]
|
|
4679
|
+
* // Indicates an element `element` was popped from `list1`.
|
|
4291
4680
|
* ```
|
|
4292
4681
|
*/
|
|
4293
4682
|
brpop(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString] | null>;
|
|
@@ -4309,7 +4698,9 @@ export declare class BaseClient {
|
|
|
4309
4698
|
* @example
|
|
4310
4699
|
* ```typescript
|
|
4311
4700
|
* const result = await client.blpop(["list1", "list2"], 5);
|
|
4312
|
-
* console.log(result);
|
|
4701
|
+
* console.log(result);
|
|
4702
|
+
* // Output: ['list1', 'element']
|
|
4703
|
+
* // An element `element` popped from the list stored at key `list1`.
|
|
4313
4704
|
* ```
|
|
4314
4705
|
*/
|
|
4315
4706
|
blpop(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString] | null>;
|
|
@@ -4326,9 +4717,14 @@ export declare class BaseClient {
|
|
|
4326
4717
|
* @example
|
|
4327
4718
|
* ```typescript
|
|
4328
4719
|
* const result = await client.pfadd("hll_1", ["a", "b", "c"]);
|
|
4329
|
-
* console.log(result);
|
|
4720
|
+
* console.log(result);
|
|
4721
|
+
* // Output: true
|
|
4722
|
+
* // Indicates that a data structure was created or modified.
|
|
4723
|
+
*
|
|
4330
4724
|
* const result = await client.pfadd("hll_2", []);
|
|
4331
|
-
* console.log(result);
|
|
4725
|
+
* console.log(result);
|
|
4726
|
+
* // Output: true
|
|
4727
|
+
* // Indicates that a new empty data structure was created.
|
|
4332
4728
|
* ```
|
|
4333
4729
|
*/
|
|
4334
4730
|
pfadd(key: GlideString, elements: GlideString[]): Promise<boolean>;
|
|
@@ -4344,7 +4740,9 @@ export declare class BaseClient {
|
|
|
4344
4740
|
* @example
|
|
4345
4741
|
* ```typescript
|
|
4346
4742
|
* const result = await client.pfcount(["hll_1", "hll_2"]);
|
|
4347
|
-
* console.log(result);
|
|
4743
|
+
* console.log(result);
|
|
4744
|
+
* // Output: 4
|
|
4745
|
+
* // The approximate cardinality of the union of `hll_1` and `hll_2`
|
|
4348
4746
|
* ```
|
|
4349
4747
|
*/
|
|
4350
4748
|
pfcount(keys: GlideString[]): Promise<number>;
|
|
@@ -4364,9 +4762,14 @@ export declare class BaseClient {
|
|
|
4364
4762
|
* await client.pfadd("hll1", ["a", "b"]);
|
|
4365
4763
|
* await client.pfadd("hll2", ["b", "c"]);
|
|
4366
4764
|
* const result = await client.pfmerge("new_hll", ["hll1", "hll2"]);
|
|
4367
|
-
* console.log(result);
|
|
4765
|
+
* console.log(result);
|
|
4766
|
+
* // Output: OK
|
|
4767
|
+
* // The value of `hll1` merged with `hll2` was stored in `new_hll`.
|
|
4768
|
+
*
|
|
4368
4769
|
* const count = await client.pfcount(["new_hll"]);
|
|
4369
|
-
* console.log(count);
|
|
4770
|
+
* console.log(count);
|
|
4771
|
+
* // Output: 3
|
|
4772
|
+
* // The approximate cardinality of `new_hll` is 3.
|
|
4370
4773
|
* ```
|
|
4371
4774
|
*/
|
|
4372
4775
|
pfmerge(destination: GlideString, sourceKeys: GlideString[]): Promise<"OK">;
|
|
@@ -4382,7 +4785,8 @@ export declare class BaseClient {
|
|
|
4382
4785
|
* @example
|
|
4383
4786
|
* ```typescript
|
|
4384
4787
|
* const result = await client.objectEncoding("my_hash");
|
|
4385
|
-
* console.log(result);
|
|
4788
|
+
* console.log(result);
|
|
4789
|
+
* // Output: "listpack"
|
|
4386
4790
|
* ```
|
|
4387
4791
|
*/
|
|
4388
4792
|
objectEncoding(key: GlideString): Promise<string | null>;
|
|
@@ -4398,7 +4802,9 @@ export declare class BaseClient {
|
|
|
4398
4802
|
* @example
|
|
4399
4803
|
* ```typescript
|
|
4400
4804
|
* const result = await client.objectFreq("my_hash");
|
|
4401
|
-
* console.log(result);
|
|
4805
|
+
* console.log(result);
|
|
4806
|
+
* // Output: 2
|
|
4807
|
+
* // The logarithmic access frequency counter of `my_hash`.
|
|
4402
4808
|
* ```
|
|
4403
4809
|
*/
|
|
4404
4810
|
objectFreq(key: GlideString): Promise<number | null>;
|
|
@@ -4413,7 +4819,9 @@ export declare class BaseClient {
|
|
|
4413
4819
|
* @example
|
|
4414
4820
|
* ```typescript
|
|
4415
4821
|
* const result = await client.objectIdletime("my_hash");
|
|
4416
|
-
* console.log(result);
|
|
4822
|
+
* console.log(result);
|
|
4823
|
+
* // Output: 13
|
|
4824
|
+
* // `my_hash` was last accessed 13 seconds ago.
|
|
4417
4825
|
* ```
|
|
4418
4826
|
*/
|
|
4419
4827
|
objectIdletime(key: GlideString): Promise<number | null>;
|
|
@@ -4429,7 +4837,9 @@ export declare class BaseClient {
|
|
|
4429
4837
|
* @example
|
|
4430
4838
|
* ```typescript
|
|
4431
4839
|
* const result = await client.objectRefcount("my_hash");
|
|
4432
|
-
* console.log(result);
|
|
4840
|
+
* console.log(result);
|
|
4841
|
+
* // Output: 2
|
|
4842
|
+
* // `my_hash` has a reference count of 2.
|
|
4433
4843
|
* ```
|
|
4434
4844
|
*/
|
|
4435
4845
|
objectRefcount(key: GlideString): Promise<number | null>;
|
|
@@ -4450,7 +4860,7 @@ export declare class BaseClient {
|
|
|
4450
4860
|
* @example
|
|
4451
4861
|
* ```typescript
|
|
4452
4862
|
* const response = await client.fcall("Deep_Thought", [], []);
|
|
4453
|
-
* console.log(response); //
|
|
4863
|
+
* console.log(response); // Returns the function's return value.
|
|
4454
4864
|
* ```
|
|
4455
4865
|
*/
|
|
4456
4866
|
fcall(func: GlideString, keys: GlideString[], args: GlideString[], options?: DecoderOption): Promise<GlideReturnType>;
|
|
@@ -4472,7 +4882,9 @@ export declare class BaseClient {
|
|
|
4472
4882
|
* ```typescript
|
|
4473
4883
|
* const response = await client.fcallReadOnly("Deep_Thought", ["key1"], ["Answer", "to", "the",
|
|
4474
4884
|
* "Ultimate", "Question", "of", "Life,", "the", "Universe,", "and", "Everything"]);
|
|
4475
|
-
* console.log(response);
|
|
4885
|
+
* console.log(response);
|
|
4886
|
+
* // Output: 42
|
|
4887
|
+
* // The return value on the function that was executed.
|
|
4476
4888
|
* ```
|
|
4477
4889
|
*/
|
|
4478
4890
|
fcallReadonly(func: GlideString, keys: GlideString[], args: GlideString[], options?: DecoderOption): Promise<GlideReturnType>;
|
|
@@ -4493,8 +4905,13 @@ export declare class BaseClient {
|
|
|
4493
4905
|
* @example
|
|
4494
4906
|
* ```typescript
|
|
4495
4907
|
* await client.rpush("myList", ["a", "b", "c", "d", "e", "e"]);
|
|
4496
|
-
* console.log(await client.lpos("myList", "e", { rank: 2 }));
|
|
4497
|
-
*
|
|
4908
|
+
* console.log(await client.lpos("myList", "e", { rank: 2 }));
|
|
4909
|
+
* // Output: 5
|
|
4910
|
+
* // The second occurrence of `e` is at index 5.
|
|
4911
|
+
*
|
|
4912
|
+
* console.log(await client.lpos("myList", "e", { count: 3 }));
|
|
4913
|
+
* // Output: [ 4, 5 ]
|
|
4914
|
+
* // indices for the occurrences of `e` in list `myList`.
|
|
4498
4915
|
* ```
|
|
4499
4916
|
*/
|
|
4500
4917
|
lpos(key: GlideString, element: GlideString, options?: LPosOptions): Promise<number | number[] | null>;
|
|
@@ -4512,11 +4929,25 @@ export declare class BaseClient {
|
|
|
4512
4929
|
*
|
|
4513
4930
|
* @example
|
|
4514
4931
|
* ```typescript
|
|
4515
|
-
* console.log(await client.bitcount("my_key1"));
|
|
4516
|
-
*
|
|
4517
|
-
*
|
|
4518
|
-
*
|
|
4519
|
-
* console.log(await client.bitcount("
|
|
4932
|
+
* console.log(await client.bitcount("my_key1"));
|
|
4933
|
+
* // Output: 2
|
|
4934
|
+
* // The string stored at `my_key1` contains 2 set bits.
|
|
4935
|
+
*
|
|
4936
|
+
* console.log(await client.bitcount("my_key2", { start: 1 }));
|
|
4937
|
+
* // Output: 8
|
|
4938
|
+
* // From the second to to the last bytes of the string stored at `my_key2` are contain 8 set bits.
|
|
4939
|
+
*
|
|
4940
|
+
* console.log(await client.bitcount("my_key2", { start: 1, end: 3 }));
|
|
4941
|
+
* // Output: 2
|
|
4942
|
+
* // The second to fourth bytes of the string stored at `my_key2` contain 2 set bits.
|
|
4943
|
+
*
|
|
4944
|
+
* console.log(await client.bitcount("my_key3", { start: 1, end: 1, indexType: BitmapIndexType.BIT }));
|
|
4945
|
+
* // Output: 1
|
|
4946
|
+
* // Indicates that the second bit of the string stored at `my_key3` is set.
|
|
4947
|
+
*
|
|
4948
|
+
* console.log(await client.bitcount("my_key3", { start: -1, end: -1, indexType: BitmapIndexType.BIT }));
|
|
4949
|
+
* // Output: 1
|
|
4950
|
+
* // Indicates that the last bit of the string stored at `my_key3` is set.
|
|
4520
4951
|
* ```
|
|
4521
4952
|
*/
|
|
4522
4953
|
bitcount(key: GlideString, options?: BitOffsetOptions): Promise<number>;
|
|
@@ -4541,7 +4972,9 @@ export declare class BaseClient {
|
|
|
4541
4972
|
* ["Palermo", { longitude: 13.361389, latitude: 38.115556 }],
|
|
4542
4973
|
* ]);
|
|
4543
4974
|
* const num = await client.geoadd("mySortedSet", membersToCoordinates, options);
|
|
4544
|
-
* console.log(num);
|
|
4975
|
+
* console.log(num);
|
|
4976
|
+
* // Output: 1
|
|
4977
|
+
* // Indicates that the position of an existing member in the sorted set `mySortedSet` has been updated.
|
|
4545
4978
|
* ```
|
|
4546
4979
|
*/
|
|
4547
4980
|
geoadd(key: GlideString, membersToGeospatialData: Map<GlideString, GeospatialData>, options?: GeoAddOptions): Promise<number>;
|
|
@@ -4575,7 +5008,9 @@ export declare class BaseClient {
|
|
|
4575
5008
|
* await client.geoadd("mySortedSet", data);
|
|
4576
5009
|
* // search for locations within 200 km circle around stored member named 'Palermo'
|
|
4577
5010
|
* const result1 = await client.geosearch("mySortedSet", { member: "Palermo" }, { radius: 200, unit: GeoUnit.KILOMETERS });
|
|
4578
|
-
* console.log(result1);
|
|
5011
|
+
* console.log(result1);
|
|
5012
|
+
* // Output: ['Palermo', 'Catania']
|
|
5013
|
+
* // Locations within the specified radius.
|
|
4579
5014
|
*
|
|
4580
5015
|
* // search for locations in 200x300 mi rectangle centered at coordinate (15, 37), requesting additional info,
|
|
4581
5016
|
* // limiting results by 2 best matches, ordered by ascending distance from the search area center
|
|
@@ -4591,7 +5026,8 @@ export declare class BaseClient {
|
|
|
4591
5026
|
* withHash: true,
|
|
4592
5027
|
* },
|
|
4593
5028
|
* );
|
|
4594
|
-
* console.log(result2);
|
|
5029
|
+
* console.log(result2);
|
|
5030
|
+
* // Output:
|
|
4595
5031
|
* // [
|
|
4596
5032
|
* // [
|
|
4597
5033
|
* // 'Catania', // location name
|
|
@@ -4645,7 +5081,8 @@ export declare class BaseClient {
|
|
|
4645
5081
|
* await client.geosearchstore("destination", "mySortedSet", { member: "Palermo" }, { radius: 200, unit: GeoUnit.KILOMETERS });
|
|
4646
5082
|
* // query the stored results
|
|
4647
5083
|
* const result1 = await client.zrangeWithScores("destination", { start: 0, end: -1 });
|
|
4648
|
-
* console.log(result1);
|
|
5084
|
+
* console.log(result1);
|
|
5085
|
+
* // Output:
|
|
4649
5086
|
* // {
|
|
4650
5087
|
* // Palermo: 3479099956230698, // geohash of the location is stored as element's score
|
|
4651
5088
|
* // Catania: 3479447370796909
|
|
@@ -4666,7 +5103,8 @@ export declare class BaseClient {
|
|
|
4666
5103
|
* );
|
|
4667
5104
|
* // query the stored results
|
|
4668
5105
|
* const result2 = await client.zrangeWithScores("destination", { start: 0, end: -1 });
|
|
4669
|
-
* console.log(result2);
|
|
5106
|
+
* console.log(result2);
|
|
5107
|
+
* // Output:
|
|
4670
5108
|
* // {
|
|
4671
5109
|
* // Palermo: 190.4424, // distance from the search area center is stored as element's score
|
|
4672
5110
|
* // Catania: 56.4413, // the distance is measured in units used for the search query (miles)
|
|
@@ -4693,11 +5131,12 @@ export declare class BaseClient {
|
|
|
4693
5131
|
* const result = await client.geopos("mySortedSet", ["Palermo", "Catania", "NonExisting"]);
|
|
4694
5132
|
* // When added via GEOADD, the geospatial coordinates are converted into a 52 bit geohash, so the coordinates
|
|
4695
5133
|
* // returned might not be exactly the same as the input values
|
|
4696
|
-
* console.log(result);
|
|
5134
|
+
* console.log(result);
|
|
5135
|
+
* // Output:
|
|
4697
5136
|
* // [
|
|
4698
|
-
* // [13.36138933897018433, 38.11555639549629859],
|
|
4699
|
-
* // [15.08726745843887329, 37.50266842333162032],
|
|
4700
|
-
* // null
|
|
5137
|
+
* // [13.36138933897018433, 38.11555639549629859], // Returns the position of member `Palermo`
|
|
5138
|
+
* // [15.08726745843887329, 37.50266842333162032], // Returns the position of member `Catania`
|
|
5139
|
+
* // null // Returns null for non existent key.
|
|
4701
5140
|
* // ]
|
|
4702
5141
|
* ```
|
|
4703
5142
|
*/
|
|
@@ -4726,11 +5165,11 @@ export declare class BaseClient {
|
|
|
4726
5165
|
* await client.zadd("zSet2", { four: 4.0 });
|
|
4727
5166
|
* console.log(await client.zmpop(["zSet1", "zSet2"], ScoreFilter.MAX, 2));
|
|
4728
5167
|
* // Output:
|
|
4729
|
-
* // "three" with score 3 and "two" with score 2 were popped from "zSet1"
|
|
4730
5168
|
* // [ "zSet1", [
|
|
4731
5169
|
* // { element: 'three', score: 3 },
|
|
4732
5170
|
* // { element: 'two', score: 2 }
|
|
4733
5171
|
* // ] ]
|
|
5172
|
+
* // `three` with score 3 and `two` with score 2 were popped from `zSet1`.
|
|
4734
5173
|
* ```
|
|
4735
5174
|
*/
|
|
4736
5175
|
zmpop(keys: GlideString[], modifier: ScoreFilter, options?: {
|
|
@@ -4764,11 +5203,11 @@ export declare class BaseClient {
|
|
|
4764
5203
|
* await client.zadd("zSet2", { four: 4.0 });
|
|
4765
5204
|
* console.log(await client.bzmpop(["zSet1", "zSet2"], ScoreFilter.MAX, 0.1, 2));
|
|
4766
5205
|
* // Output:
|
|
4767
|
-
* // "three" with score 3 and "two" with score 2 were popped from "zSet1"
|
|
4768
5206
|
* // [ "zSet1", [
|
|
4769
5207
|
* // { element: 'three', score: 3 },
|
|
4770
5208
|
* // { element: 'two', score: 2 }
|
|
4771
5209
|
* // ] ]
|
|
5210
|
+
* // `three` with score 3 and `two` with score 2 were popped from `zSet1`
|
|
4772
5211
|
* ```
|
|
4773
5212
|
*/
|
|
4774
5213
|
bzmpop(keys: GlideString[], modifier: ScoreFilter, timeout: number, options?: {
|
|
@@ -4791,12 +5230,18 @@ export declare class BaseClient {
|
|
|
4791
5230
|
* ```typescript
|
|
4792
5231
|
* // Example usage of zincrBy method to increment the value of a member's score
|
|
4793
5232
|
* await client.zadd("my_sorted_set", {"member": 10.5, "member2": 8.2});
|
|
5233
|
+
*
|
|
4794
5234
|
* console.log(await client.zincrby("my_sorted_set", 1.2, "member"));
|
|
4795
|
-
* // Output: 11.7
|
|
5235
|
+
* // Output: 11.7
|
|
5236
|
+
* // The member existed in the set before score was altered, the new score is 11.7.
|
|
5237
|
+
*
|
|
4796
5238
|
* console.log(await client.zincrby("my_sorted_set", -1.7, "member"));
|
|
4797
|
-
* // Output: 10.0
|
|
5239
|
+
* // Output: 10.0
|
|
5240
|
+
* // Negative increment, decrements the score.
|
|
5241
|
+
*
|
|
4798
5242
|
* console.log(await client.zincrby("my_sorted_set", 5.5, "non_existing_member"));
|
|
4799
|
-
* // Output: 5.5
|
|
5243
|
+
* // Output: 5.5
|
|
5244
|
+
* // A new member is added to the sorted set with the score of 5.5.
|
|
4800
5245
|
* ```
|
|
4801
5246
|
*/
|
|
4802
5247
|
zincrby(key: GlideString, increment: number, member: GlideString): Promise<number>;
|
|
@@ -4881,7 +5326,8 @@ export declare class BaseClient {
|
|
|
4881
5326
|
* @example
|
|
4882
5327
|
* ```typescript
|
|
4883
5328
|
* const result = await client.geodist("mySortedSet", "Place1", "Place2", { unit: GeoUnit.KILOMETERS });
|
|
4884
|
-
* console.log(num);
|
|
5329
|
+
* console.log(num);
|
|
5330
|
+
* // Output: the distance between Place1 and Place2.
|
|
4885
5331
|
* ```
|
|
4886
5332
|
*/
|
|
4887
5333
|
geodist(key: GlideString, member1: GlideString, member2: GlideString, options?: {
|
|
@@ -4900,7 +5346,9 @@ export declare class BaseClient {
|
|
|
4900
5346
|
* @example
|
|
4901
5347
|
* ```typescript
|
|
4902
5348
|
* const result = await client.geohash("mySortedSet", ["Palermo", "Catania", "NonExisting"]);
|
|
4903
|
-
* console.log(result);
|
|
5349
|
+
* console.log(result);
|
|
5350
|
+
* // Output: ["sqc8b49rny0", "sqdtr74hyu0", null]
|
|
5351
|
+
* // An array of GeoHash string.
|
|
4904
5352
|
* ```
|
|
4905
5353
|
*/
|
|
4906
5354
|
geohash(key: GlideString, members: GlideString[]): Promise<(string | null)[]>;
|
|
@@ -4921,7 +5369,9 @@ export declare class BaseClient {
|
|
|
4921
5369
|
* ```typescript
|
|
4922
5370
|
* await client.mset({"testKey1": "abcd", "testKey2": "axcd"});
|
|
4923
5371
|
* const result = await client.lcs("testKey1", "testKey2");
|
|
4924
|
-
* console.log(result);
|
|
5372
|
+
* console.log(result);
|
|
5373
|
+
* // Output: 'acd'
|
|
5374
|
+
* // Returned the longest common subsequence of strings stored at `testKey1` and `testKey2`.
|
|
4925
5375
|
* ```
|
|
4926
5376
|
*/
|
|
4927
5377
|
lcs(key1: GlideString, key2: GlideString, options?: DecoderOption): Promise<string>;
|
|
@@ -4941,7 +5391,9 @@ export declare class BaseClient {
|
|
|
4941
5391
|
* ```typescript
|
|
4942
5392
|
* await client.mset({"testKey1": "abcd", "testKey2": "axcd"});
|
|
4943
5393
|
* const result = await client.lcsLen("testKey1", "testKey2");
|
|
4944
|
-
* console.log(result);
|
|
5394
|
+
* console.log(result);
|
|
5395
|
+
* // Output: 3
|
|
5396
|
+
* // The total length of all the longest common subsequences between the strings stored at `testKey1` and `testKey2`.
|
|
4945
5397
|
* ```
|
|
4946
5398
|
*/
|
|
4947
5399
|
lcsLen(key1: GlideString, key2: GlideString, options?: DecoderOption): Promise<number>;
|
|
@@ -4973,7 +5425,8 @@ export declare class BaseClient {
|
|
|
4973
5425
|
* ```typescript
|
|
4974
5426
|
* await client.mset({"key1": "ohmytext", "key2": "mynewtext"});
|
|
4975
5427
|
* const result = await client.lcsIdx("key1", "key2");
|
|
4976
|
-
* console.log(result);
|
|
5428
|
+
* console.log(result);
|
|
5429
|
+
* // Output:
|
|
4977
5430
|
* {
|
|
4978
5431
|
* "matches" :
|
|
4979
5432
|
* [
|
|
@@ -5017,7 +5470,9 @@ export declare class BaseClient {
|
|
|
5017
5470
|
* await client.set("key1", "value1");
|
|
5018
5471
|
* await client.set("key2", "value2");
|
|
5019
5472
|
* const result = await client.touch(["key1", "key2", "nonExistingKey"]);
|
|
5020
|
-
* console.log(result);
|
|
5473
|
+
* console.log(result);
|
|
5474
|
+
* // Output: 2
|
|
5475
|
+
* // The last access time of 2 keys has been updated.
|
|
5021
5476
|
* ```
|
|
5022
5477
|
*/
|
|
5023
5478
|
touch(keys: GlideString[]): Promise<number>;
|
|
@@ -5042,18 +5497,27 @@ export declare class BaseClient {
|
|
|
5042
5497
|
* @example
|
|
5043
5498
|
* ```typescript
|
|
5044
5499
|
* const response = await client.watch(["sampleKey"]);
|
|
5045
|
-
* console.log(response);
|
|
5500
|
+
* console.log(response);
|
|
5501
|
+
* // Output: "OK"
|
|
5502
|
+
*
|
|
5046
5503
|
* const transaction = new Batch(true).set("SampleKey", "foobar");
|
|
5047
5504
|
* const result = await client.exec(transaction);
|
|
5048
|
-
* console.log(result);
|
|
5505
|
+
* console.log(result);
|
|
5506
|
+
*
|
|
5507
|
+
* // Output: "OK"
|
|
5508
|
+
* // Executes successfully and keys are unwatched.
|
|
5049
5509
|
* ```
|
|
5050
5510
|
* ```typescript
|
|
5051
5511
|
* const response = await client.watch(["sampleKey"]);
|
|
5052
|
-
* console.log(response);
|
|
5512
|
+
* console.log(response);
|
|
5513
|
+
* // Output: "OK"
|
|
5514
|
+
*
|
|
5053
5515
|
* const transaction = new Batch(true).set("SampleKey", "foobar");
|
|
5054
5516
|
* await client.set("sampleKey", "hello world");
|
|
5055
5517
|
* const result = await client.exec(transaction);
|
|
5056
|
-
* console.log(result);
|
|
5518
|
+
* console.log(result);
|
|
5519
|
+
* // Output: null
|
|
5520
|
+
* // null is returned when the watched key is modified before transaction execution.
|
|
5057
5521
|
* ```
|
|
5058
5522
|
*/
|
|
5059
5523
|
watch(keys: GlideString[]): Promise<"OK">;
|
|
@@ -5072,7 +5536,8 @@ export declare class BaseClient {
|
|
|
5072
5536
|
* ```typescript
|
|
5073
5537
|
* await client.set(key, value);
|
|
5074
5538
|
* let response = await client.wait(1, 1000);
|
|
5075
|
-
* console.log(response);
|
|
5539
|
+
* console.log(response);
|
|
5540
|
+
* // Output: return 1 when a replica is reached or 0 if 1000ms is reached.
|
|
5076
5541
|
* ```
|
|
5077
5542
|
*/
|
|
5078
5543
|
wait(numreplicas: number, timeout: number): Promise<number>;
|
|
@@ -5091,9 +5556,14 @@ export declare class BaseClient {
|
|
|
5091
5556
|
* @example
|
|
5092
5557
|
* ```typescript
|
|
5093
5558
|
* const len = await client.setrange("key", 6, "GLIDE");
|
|
5094
|
-
* console.log(len);
|
|
5559
|
+
* console.log(len);
|
|
5560
|
+
* // Output: 11
|
|
5561
|
+
* // New key was created with length of 11 symbols
|
|
5562
|
+
*
|
|
5095
5563
|
* const value = await client.get("key");
|
|
5096
|
-
* console.log(result);
|
|
5564
|
+
* console.log(result);
|
|
5565
|
+
* // Output: "\0\0\0\0\0\0GLIDE"
|
|
5566
|
+
* // The string was padded with zero bytes
|
|
5097
5567
|
* ```
|
|
5098
5568
|
*/
|
|
5099
5569
|
setrange(key: GlideString, offset: number, value: GlideString): Promise<number>;
|
|
@@ -5111,12 +5581,15 @@ export declare class BaseClient {
|
|
|
5111
5581
|
* ```typescript
|
|
5112
5582
|
* const len = await client.append("key", "Hello");
|
|
5113
5583
|
* console.log(len);
|
|
5114
|
-
*
|
|
5115
|
-
*
|
|
5584
|
+
* // Output: 5
|
|
5585
|
+
* // Indicates that "Hello" has been appended to the value of "key", which was initially
|
|
5586
|
+
* // empty, resulting in a new value of "Hello" with a length of 5 - similar to the set operation.
|
|
5587
|
+
*
|
|
5116
5588
|
* len = await client.append("key", " world");
|
|
5117
5589
|
* console.log(result);
|
|
5118
|
-
*
|
|
5119
|
-
*
|
|
5590
|
+
* // Output: 11
|
|
5591
|
+
* // Indicates that " world" has been appended to the value of "key", resulting in a
|
|
5592
|
+
* // new value of "Hello world" with a length of 11.
|
|
5120
5593
|
* ```
|
|
5121
5594
|
*/
|
|
5122
5595
|
append(key: GlideString, value: GlideString): Promise<number>;
|
|
@@ -5140,7 +5613,8 @@ export declare class BaseClient {
|
|
|
5140
5613
|
* await client.lpush("testKey", ["one", "two", "three"]);
|
|
5141
5614
|
* await client.lpush("testKey2", ["five", "six", "seven"]);
|
|
5142
5615
|
* const result = await client.lmpop(["testKey", "testKey2"], ListDirection.LEFT, 1L);
|
|
5143
|
-
* console.log(result);
|
|
5616
|
+
* console.log(result);
|
|
5617
|
+
* // Output: { key: "testKey", elements: ["three"] }
|
|
5144
5618
|
* ```
|
|
5145
5619
|
*/
|
|
5146
5620
|
lmpop(keys: GlideString[], direction: ListDirection, options?: {
|
|
@@ -5171,7 +5645,8 @@ export declare class BaseClient {
|
|
|
5171
5645
|
* await client.lpush("testKey", ["one", "two", "three"]);
|
|
5172
5646
|
* await client.lpush("testKey2", ["five", "six", "seven"]);
|
|
5173
5647
|
* const result = await client.blmpop(["testKey", "testKey2"], ListDirection.LEFT, 0.1, 1);
|
|
5174
|
-
* console.log(result"testKey");
|
|
5648
|
+
* console.log(result"testKey");
|
|
5649
|
+
* // Output: { key: "testKey", elements: ["three"] }
|
|
5175
5650
|
* ```
|
|
5176
5651
|
*/
|
|
5177
5652
|
blmpop(keys: GlideString[], direction: ListDirection, timeout: number, options?: {
|
|
@@ -5196,10 +5671,12 @@ export declare class BaseClient {
|
|
|
5196
5671
|
* @example
|
|
5197
5672
|
* ```typescript
|
|
5198
5673
|
* const channels = await client.pubsubChannels();
|
|
5199
|
-
* console.log(channels);
|
|
5674
|
+
* console.log(channels);
|
|
5675
|
+
* // Output: ["channel1", "channel2"]
|
|
5200
5676
|
*
|
|
5201
5677
|
* const newsChannels = await client.pubsubChannels("news.*");
|
|
5202
|
-
* console.log(newsChannels);
|
|
5678
|
+
* console.log(newsChannels);
|
|
5679
|
+
* // Output: ["news.sports", "news.weather"]
|
|
5203
5680
|
* ```
|
|
5204
5681
|
*/
|
|
5205
5682
|
pubsubChannels(options?: {
|
|
@@ -5219,7 +5696,8 @@ export declare class BaseClient {
|
|
|
5219
5696
|
* @example
|
|
5220
5697
|
* ```typescript
|
|
5221
5698
|
* const patternCount = await client.pubsubNumpat();
|
|
5222
|
-
* console.log(patternCount);
|
|
5699
|
+
* console.log(patternCount);
|
|
5700
|
+
* // Output: 3
|
|
5223
5701
|
* ```
|
|
5224
5702
|
*/
|
|
5225
5703
|
pubsubNumPat(): Promise<number>;
|
|
@@ -5236,11 +5714,12 @@ export declare class BaseClient {
|
|
|
5236
5714
|
* @example
|
|
5237
5715
|
* ```typescript
|
|
5238
5716
|
* const result1 = await client.pubsubNumsub(["channel1", "channel2"]);
|
|
5239
|
-
* console.log(result1);
|
|
5240
|
-
* // [{ channel: "channel1", numSub: 3}, { channel: "channel2", numSub: 5 }]
|
|
5717
|
+
* console.log(result1);
|
|
5718
|
+
* // Output: [{ channel: "channel1", numSub: 3}, { channel: "channel2", numSub: 5 }]
|
|
5241
5719
|
*
|
|
5242
5720
|
* const result2 = await client.pubsubNumsub([]);
|
|
5243
|
-
* console.log(result2);
|
|
5721
|
+
* console.log(result2);
|
|
5722
|
+
* // Output: []
|
|
5244
5723
|
* ```
|
|
5245
5724
|
*/
|
|
5246
5725
|
pubsubNumSub(channels: GlideString[], options?: DecoderOption): Promise<{
|
|
@@ -5270,7 +5749,9 @@ export declare class BaseClient {
|
|
|
5270
5749
|
* await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
|
|
5271
5750
|
* await client.lpush("user_ids", ["2", "1"]);
|
|
5272
5751
|
* const result = await client.sort("user_ids", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
|
|
5273
|
-
* console.log(result);
|
|
5752
|
+
* console.log(result);
|
|
5753
|
+
* // Output: [ 'Bob', 'Alice' ]
|
|
5754
|
+
* // Returns a list of the names sorted by age
|
|
5274
5755
|
* ```
|
|
5275
5756
|
*/
|
|
5276
5757
|
sort(key: GlideString, options?: SortOptions & DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -5297,7 +5778,9 @@ export declare class BaseClient {
|
|
|
5297
5778
|
* await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
|
|
5298
5779
|
* await client.lpush("user_ids", ["2", "1"]);
|
|
5299
5780
|
* const result = await client.sortReadOnly("user_ids", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
|
|
5300
|
-
* console.log(result);
|
|
5781
|
+
* console.log(result);
|
|
5782
|
+
* // Output: [ 'Bob', 'Alice' ]
|
|
5783
|
+
* // Returns a list of the names sorted by age
|
|
5301
5784
|
* ```
|
|
5302
5785
|
*/
|
|
5303
5786
|
sortReadOnly(key: GlideString, options?: SortOptions & DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -5326,8 +5809,13 @@ export declare class BaseClient {
|
|
|
5326
5809
|
* await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
|
|
5327
5810
|
* await client.lpush("user_ids", ["2", "1"]);
|
|
5328
5811
|
* const sortedElements = await client.sortStore("user_ids", "sortedList", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
|
|
5329
|
-
* console.log(sortedElements);
|
|
5330
|
-
*
|
|
5812
|
+
* console.log(sortedElements);
|
|
5813
|
+
* // Output: 2
|
|
5814
|
+
* // number of elements sorted and stored
|
|
5815
|
+
*
|
|
5816
|
+
* console.log(await client.lrange("sortedList", 0, -1));
|
|
5817
|
+
* // Output: [ 'Bob', 'Alice' ]
|
|
5818
|
+
* // Returns a list of the names sorted by age stored in `sortedList`
|
|
5331
5819
|
* ```
|
|
5332
5820
|
*/
|
|
5333
5821
|
sortStore(key: GlideString, destination: GlideString, options?: SortOptions): Promise<number>;
|
|
@@ -5353,7 +5841,8 @@ export declare class BaseClient {
|
|
|
5353
5841
|
*
|
|
5354
5842
|
* @example
|
|
5355
5843
|
* ```typescript
|
|
5356
|
-
* await client.updateConnectionPassword("newPassword", true)
|
|
5844
|
+
* await client.updateConnectionPassword("newPassword", true)
|
|
5845
|
+
* // Output: "OK"
|
|
5357
5846
|
* ```
|
|
5358
5847
|
*/
|
|
5359
5848
|
updateConnectionPassword(password: string | null, immediateAuth?: boolean): Promise<GlideString>;
|