@valkey/valkey-glide 2.0.0-rc5 → 2.0.0
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 +896 -371
- package/build-ts/BaseClient.js +861 -371
- package/build-ts/Batch.d.ts +4 -4
- package/build-ts/Batch.js +4 -4
- package/build-ts/ProtobufMessage.d.ts +6 -0
- package/build-ts/ProtobufMessage.js +15 -0
- package/package.json +7 -7
package/build-ts/BaseClient.d.ts
CHANGED
|
@@ -144,6 +144,7 @@ export type ReadFrom =
|
|
|
144
144
|
* - **Addresses**: Use the `addresses` property to specify the hostnames and ports of the server(s) to connect to.
|
|
145
145
|
* - **Cluster Mode**: In cluster mode, the client will discover other nodes based on the provided addresses.
|
|
146
146
|
* - **Standalone Mode**: In standalone mode, only the provided nodes will be used.
|
|
147
|
+
* - **Lazy Connect**: Set `lazyConnect` to `true` to defer connection establishment until the first command is sent.
|
|
147
148
|
*
|
|
148
149
|
* ### Security Settings
|
|
149
150
|
*
|
|
@@ -210,6 +211,7 @@ export type ReadFrom =
|
|
|
210
211
|
* exponentBase: 2, // Delay doubles with each retry (2^N)
|
|
211
212
|
* jitterPercent: 20, // Optional jitter percentage
|
|
212
213
|
* },
|
|
214
|
+
* lazyConnect: true,
|
|
213
215
|
* };
|
|
214
216
|
* ```
|
|
215
217
|
*/
|
|
@@ -326,6 +328,40 @@ export interface BaseClientConfiguration {
|
|
|
326
328
|
*/
|
|
327
329
|
jitterPercent?: number;
|
|
328
330
|
};
|
|
331
|
+
/**
|
|
332
|
+
* Enables lazy connection mode, where physical connections to the server(s) are deferred
|
|
333
|
+
* until the first command is sent. This can reduce startup latency and allow for client
|
|
334
|
+
* creation in disconnected environments.
|
|
335
|
+
*
|
|
336
|
+
* - **Default**: `false` – connections are established immediately during client creation.
|
|
337
|
+
*
|
|
338
|
+
* @remarks
|
|
339
|
+
* When `lazyConnect` is set to `true`, the client will not attempt to connect to the specified
|
|
340
|
+
* nodes during initialization. Instead, connections will be established only when a command is
|
|
341
|
+
* actually executed.
|
|
342
|
+
*
|
|
343
|
+
* Note that the first command executed with lazy connections may experience additional latency
|
|
344
|
+
* as it needs to establish the connection first. During this initial connection, the standard
|
|
345
|
+
* request timeout does not apply yet - instead, the connection establishment is governed by
|
|
346
|
+
* `AdvancedBaseClientConfiguration::connectionTimeout`. The request timeout (`requestTimeout`)
|
|
347
|
+
* only begins counting after the connection has been successfully established. This behavior
|
|
348
|
+
* can effectively increase the total time needed for the first command to complete.
|
|
349
|
+
*
|
|
350
|
+
* This setting applies to both standalone and cluster modes. Note that if an operation is
|
|
351
|
+
* attempted and connection fails (e.g., unreachable nodes), errors will surface at that point.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```typescript
|
|
355
|
+
* const client = await GlideClient.createClient({
|
|
356
|
+
* addresses: [{ host: "localhost", port: 6379 }],
|
|
357
|
+
* lazyConnect: true
|
|
358
|
+
* });
|
|
359
|
+
*
|
|
360
|
+
* // No connection is made yet
|
|
361
|
+
* await client.ping(); // Now the client connects and sends the command
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
lazyConnect?: boolean;
|
|
329
365
|
}
|
|
330
366
|
/**
|
|
331
367
|
* Represents advanced configuration settings for a client, including connection-related options.
|
|
@@ -452,10 +488,13 @@ export declare class BaseClient {
|
|
|
452
488
|
* ```typescript
|
|
453
489
|
* // Example usage of get method to retrieve the value of a key
|
|
454
490
|
* const result = await client.get("key");
|
|
455
|
-
* console.log(result);
|
|
491
|
+
* console.log(result);
|
|
492
|
+
* // Output: 'value'
|
|
493
|
+
*
|
|
456
494
|
* // Example usage of get method to retrieve the value of a key with Bytes decoder
|
|
457
495
|
* const result = await client.get("key", { decoder: Decoder.Bytes });
|
|
458
|
-
* console.log(result);
|
|
496
|
+
* console.log(result);
|
|
497
|
+
* // Output: <Buffer 76 61 6c 75 65>
|
|
459
498
|
* ```
|
|
460
499
|
*/
|
|
461
500
|
get(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -476,7 +515,8 @@ export declare class BaseClient {
|
|
|
476
515
|
* @example
|
|
477
516
|
* ```typescript
|
|
478
517
|
* const result = await client.getex("key", {expiry: { type: TimeUnit.Seconds, count: 5 }});
|
|
479
|
-
* console.log(result);
|
|
518
|
+
* console.log(result);
|
|
519
|
+
* // Output: 'value'
|
|
480
520
|
* ```
|
|
481
521
|
*/
|
|
482
522
|
getex(key: GlideString, options?: {
|
|
@@ -497,7 +537,8 @@ export declare class BaseClient {
|
|
|
497
537
|
* @example
|
|
498
538
|
* ```typescript
|
|
499
539
|
* const result = client.getdel("key");
|
|
500
|
-
* console.log(result);
|
|
540
|
+
* console.log(result);
|
|
541
|
+
* // Output: 'value'
|
|
501
542
|
*
|
|
502
543
|
* const value = client.getdel("key"); // value is null
|
|
503
544
|
* ```
|
|
@@ -522,13 +563,21 @@ export declare class BaseClient {
|
|
|
522
563
|
* ```typescript
|
|
523
564
|
* await client.set("mykey", "This is a string")
|
|
524
565
|
* let result = await client.getrange("mykey", 0, 3)
|
|
525
|
-
* console.log(result);
|
|
566
|
+
* console.log(result);
|
|
567
|
+
* // Output: "This"
|
|
568
|
+
*
|
|
526
569
|
* result = await client.getrange("mykey", -3, -1)
|
|
527
|
-
* console.log(result);
|
|
570
|
+
* console.log(result);
|
|
571
|
+
* // Output: "ing"
|
|
572
|
+
* // extracted last 3 characters of a string
|
|
573
|
+
*
|
|
528
574
|
* result = await client.getrange("mykey", 0, 100)
|
|
529
|
-
* console.log(result);
|
|
575
|
+
* console.log(result);
|
|
576
|
+
* // Output: "This is a string"
|
|
577
|
+
*
|
|
530
578
|
* result = await client.getrange("mykey", 5, 6)
|
|
531
|
-
* console.log(result);
|
|
579
|
+
* console.log(result);
|
|
580
|
+
* // Output: ""
|
|
532
581
|
* ```
|
|
533
582
|
*/
|
|
534
583
|
getrange(key: GlideString, start: number, end: number, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -552,22 +601,33 @@ export declare class BaseClient {
|
|
|
552
601
|
*
|
|
553
602
|
* // Example usage of set method with conditional options and expiration
|
|
554
603
|
* const result2 = await client.set("key", "new_value", {conditionalSet: "onlyIfExists", expiry: { type: TimeUnit.Seconds, count: 5 }});
|
|
555
|
-
* 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.
|
|
556
607
|
*
|
|
557
608
|
* // Example usage of set method with conditional options and returning old value
|
|
558
609
|
* const result3 = await client.set("key", "value", {conditionalSet: "onlyIfDoesNotExist", returnOldValue: true});
|
|
559
|
-
* console.log(result3);
|
|
610
|
+
* console.log(result3);
|
|
611
|
+
* // Output: 'new_value'
|
|
612
|
+
* // Returns the old value of `key`.
|
|
560
613
|
*
|
|
561
614
|
* // Example usage of get method to retrieve the value of a key
|
|
562
615
|
* const result4 = await client.get("key");
|
|
563
|
-
* console.log(result4);
|
|
616
|
+
* console.log(result4);
|
|
617
|
+
* // Output: 'new_value'
|
|
618
|
+
* // Value wasn't modified back to being "value" because of "NX" flag.
|
|
564
619
|
*
|
|
565
620
|
* // Example usage of set method with conditional option IFEQ
|
|
566
621
|
* await client.set("key", "value we will compare to");
|
|
567
622
|
* const result5 = await client.set("key", "new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
|
|
568
|
-
* 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
|
+
*
|
|
569
627
|
* const result6 = await client.set("key", "another_new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
|
|
570
|
-
* 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".
|
|
571
631
|
* ```
|
|
572
632
|
*/
|
|
573
633
|
set(key: GlideString, value: GlideString, options?: SetOptions & DecoderOption): Promise<"OK" | GlideString | null>;
|
|
@@ -614,13 +674,15 @@ export declare class BaseClient {
|
|
|
614
674
|
* @example
|
|
615
675
|
* ```typescript
|
|
616
676
|
* let result = await client.dump("myKey");
|
|
617
|
-
* console.log(result);
|
|
677
|
+
* console.log(result);
|
|
678
|
+
* // Result contains the serialized value of `myKey`
|
|
618
679
|
* ```
|
|
619
680
|
*
|
|
620
681
|
* @example
|
|
621
682
|
* ```typescript
|
|
622
683
|
* result = await client.dump("nonExistingKey");
|
|
623
|
-
* console.log(result);
|
|
684
|
+
* console.log(result);
|
|
685
|
+
* // Output: null
|
|
624
686
|
* ```
|
|
625
687
|
*/
|
|
626
688
|
dump(key: GlideString): Promise<Buffer | null>;
|
|
@@ -685,7 +747,8 @@ export declare class BaseClient {
|
|
|
685
747
|
* await client.set("key1", "value1");
|
|
686
748
|
* await client.set("key2", "value2");
|
|
687
749
|
* const result = await client.mget(["key1", "key2"]);
|
|
688
|
-
* console.log(result);
|
|
750
|
+
* console.log(result);
|
|
751
|
+
* // Output: ['value1', 'value2']
|
|
689
752
|
* ```
|
|
690
753
|
*/
|
|
691
754
|
mget(keys: GlideString[], options?: DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -842,10 +905,14 @@ export declare class BaseClient {
|
|
|
842
905
|
* await client.set("key1", "A"); // "A" has binary value 01000001
|
|
843
906
|
* await client.set("key2", "B"); // "B" has binary value 01000010
|
|
844
907
|
* const result1 = await client.bitop(BitwiseOperation.AND, "destination", ["key1", "key2"]);
|
|
845
|
-
* console.log(result1);
|
|
908
|
+
* console.log(result1);
|
|
909
|
+
* // Output: 1
|
|
910
|
+
* // The size of the resulting string stored in "destination" is 1.
|
|
846
911
|
*
|
|
847
912
|
* const result2 = await client.get("destination");
|
|
848
|
-
* console.log(result2);
|
|
913
|
+
* console.log(result2);
|
|
914
|
+
* // Output: "@"
|
|
915
|
+
* // "@" has binary value 01000000
|
|
849
916
|
* ```
|
|
850
917
|
*/
|
|
851
918
|
bitop(operation: BitwiseOperation, destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -863,7 +930,9 @@ export declare class BaseClient {
|
|
|
863
930
|
* @example
|
|
864
931
|
* ```typescript
|
|
865
932
|
* const result = await client.getbit("key", 1);
|
|
866
|
-
* console.log(result);
|
|
933
|
+
* console.log(result);
|
|
934
|
+
* // Output: 1
|
|
935
|
+
* // The second bit of the string stored at `key` is set to 1.
|
|
867
936
|
* ```
|
|
868
937
|
*/
|
|
869
938
|
getbit(key: GlideString, offset: number): Promise<number>;
|
|
@@ -883,7 +952,9 @@ export declare class BaseClient {
|
|
|
883
952
|
* @example
|
|
884
953
|
* ```typescript
|
|
885
954
|
* const result = await client.setbit("key", 1, 1);
|
|
886
|
-
* console.log(result);
|
|
955
|
+
* console.log(result);
|
|
956
|
+
* // Output: 0
|
|
957
|
+
* // The second bit value was 0 before setting to 1.
|
|
887
958
|
* ```
|
|
888
959
|
*/
|
|
889
960
|
setbit(key: GlideString, offset: number, value: number): Promise<number>;
|
|
@@ -906,17 +977,25 @@ export declare class BaseClient {
|
|
|
906
977
|
* ```typescript
|
|
907
978
|
* await client.set("key1", "A1"); // "A1" has binary value 01000001 00110001
|
|
908
979
|
* const result1 = await client.bitpos("key1", 1);
|
|
909
|
-
* 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.
|
|
910
983
|
*
|
|
911
984
|
* const result2 = await client.bitpos("key1", 1, { start: -1 });
|
|
912
|
-
* 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.
|
|
913
988
|
*
|
|
914
989
|
* await client.set("key1", "A12"); // "A12" has binary value 01000001 00110001 00110010
|
|
915
990
|
* const result3 = await client.bitpos("key1", 1, { start: 1, end: -1 });
|
|
916
|
-
* 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.
|
|
917
994
|
*
|
|
918
995
|
* const result4 = await client.bitpos("key1", 1, { start: 2, end: 9, indexType: BitmapIndexType.BIT });
|
|
919
|
-
* 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.
|
|
920
999
|
* ```
|
|
921
1000
|
*/
|
|
922
1001
|
bitpos(key: GlideString, bit: number, options?: BitOffsetOptions): Promise<number>;
|
|
@@ -948,7 +1027,9 @@ export declare class BaseClient {
|
|
|
948
1027
|
* ```typescript
|
|
949
1028
|
* await client.set("key", "A"); // "A" has binary value 01000001
|
|
950
1029
|
* const result = await client.bitfield("key", [new BitFieldSet(new UnsignedEncoding(2), new BitOffset(1), 3), new BitFieldGet(new UnsignedEncoding(2), new BitOffset(1))]);
|
|
951
|
-
* 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.
|
|
952
1033
|
* ```
|
|
953
1034
|
*/
|
|
954
1035
|
bitfield(key: GlideString, subcommands: BitFieldSubCommands[]): Promise<(number | null)[]>;
|
|
@@ -966,7 +1047,9 @@ export declare class BaseClient {
|
|
|
966
1047
|
* ```typescript
|
|
967
1048
|
* await client.set("key", "A"); // "A" has binary value 01000001
|
|
968
1049
|
* const result = await client.bitfieldReadOnly("key", [new BitFieldGet(new UnsignedEncoding(2), new BitOffset(1))]);
|
|
969
|
-
* console.log(result);
|
|
1050
|
+
* console.log(result);
|
|
1051
|
+
* // Output: [2]
|
|
1052
|
+
* // The value at offset 1 with an unsigned encoding of 2 is 2.
|
|
970
1053
|
* ```
|
|
971
1054
|
*/
|
|
972
1055
|
bitfieldReadOnly(key: GlideString, subcommands: BitFieldGet[]): Promise<number[]>;
|
|
@@ -984,14 +1067,18 @@ export declare class BaseClient {
|
|
|
984
1067
|
* // Example usage of the hget method on an-existing field
|
|
985
1068
|
* await client.hset("my_hash", {"field": "value"});
|
|
986
1069
|
* const result = await client.hget("my_hash", "field");
|
|
987
|
-
* console.log(result);
|
|
1070
|
+
* console.log(result);
|
|
1071
|
+
* // Output: "value"
|
|
1072
|
+
* // The value associated with `field` in the key `my_hash`.
|
|
988
1073
|
* ```
|
|
989
1074
|
*
|
|
990
1075
|
* @example
|
|
991
1076
|
* ```typescript
|
|
992
1077
|
* // Example usage of the hget method on a non-existing field
|
|
993
1078
|
* const result = await client.hget("my_hash", "nonexistent_field");
|
|
994
|
-
* console.log(result);
|
|
1079
|
+
* console.log(result);
|
|
1080
|
+
* // Output: null
|
|
1081
|
+
* // Indicates non existent key.
|
|
995
1082
|
* ```
|
|
996
1083
|
*/
|
|
997
1084
|
hget(key: GlideString, field: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1007,11 +1094,15 @@ export declare class BaseClient {
|
|
|
1007
1094
|
* ```typescript
|
|
1008
1095
|
* // Example usage of the hset method using HashDataType as input type
|
|
1009
1096
|
* const result = await client.hset("my_hash", [{"field": "field1", "value": "value1"}, {"field": "field2", "value": "value2"}]);
|
|
1010
|
-
* console.log(result);
|
|
1097
|
+
* console.log(result);
|
|
1098
|
+
* // Output: 2
|
|
1099
|
+
* // Indicates that 2 fields were successfully set in the hash `my_hash`.
|
|
1011
1100
|
*
|
|
1012
1101
|
* // Example usage of the hset method using Record<string, GlideString> as input
|
|
1013
1102
|
* const result = await client.hset("my_hash", {"field1": "value", "field2": "value2"});
|
|
1014
|
-
* console.log(result);
|
|
1103
|
+
* console.log(result);
|
|
1104
|
+
* // Output: 2
|
|
1105
|
+
* // Indicates that 2 fields were successfully set in the hash `my_hash`.
|
|
1015
1106
|
* ```
|
|
1016
1107
|
*/
|
|
1017
1108
|
hset(key: GlideString, fieldsAndValues: HashDataType | Record<string, GlideString>): Promise<number>;
|
|
@@ -1029,7 +1120,9 @@ export declare class BaseClient {
|
|
|
1029
1120
|
* // Example usage of the hkeys method:
|
|
1030
1121
|
* await client.hset("my_hash", {"field1": "value1", "field2": "value2", "field3": "value3"});
|
|
1031
1122
|
* const result = await client.hkeys("my_hash");
|
|
1032
|
-
* console.log(result);
|
|
1123
|
+
* console.log(result);
|
|
1124
|
+
* // Output: ["field1", "field2", "field3"]
|
|
1125
|
+
* // Returns all the field names stored in the hash `my_hash`.
|
|
1033
1126
|
* ```
|
|
1034
1127
|
*/
|
|
1035
1128
|
hkeys(key: GlideString, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1048,14 +1141,18 @@ export declare class BaseClient {
|
|
|
1048
1141
|
* ```typescript
|
|
1049
1142
|
* // Example usage of the hsetnx method
|
|
1050
1143
|
* const result = await client.hsetnx("my_hash", "field", "value");
|
|
1051
|
-
* console.log(result);
|
|
1144
|
+
* console.log(result);
|
|
1145
|
+
* // Output: true
|
|
1146
|
+
* // Indicates that the field "field" was set successfully in the hash `my_hash`.
|
|
1052
1147
|
* ```
|
|
1053
1148
|
*
|
|
1054
1149
|
* @example
|
|
1055
1150
|
* ```typescript
|
|
1056
1151
|
* // Example usage of the hsetnx method on a field that already exists
|
|
1057
1152
|
* const result = await client.hsetnx("my_hash", "field", "new_value");
|
|
1058
|
-
* 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.
|
|
1059
1156
|
* ```
|
|
1060
1157
|
*/
|
|
1061
1158
|
hsetnx(key: GlideString, field: GlideString, value: GlideString): Promise<boolean>;
|
|
@@ -1073,7 +1170,9 @@ export declare class BaseClient {
|
|
|
1073
1170
|
* ```typescript
|
|
1074
1171
|
* // Example usage of the hdel method
|
|
1075
1172
|
* const result = await client.hdel("my_hash", ["field1", "field2"]);
|
|
1076
|
-
* console.log(result);
|
|
1173
|
+
* console.log(result);
|
|
1174
|
+
* // Output: 2
|
|
1175
|
+
* // Indicates that two fields were successfully removed from the hash.
|
|
1077
1176
|
* ```
|
|
1078
1177
|
*/
|
|
1079
1178
|
hdel(key: GlideString, fields: GlideString[]): Promise<number>;
|
|
@@ -1092,7 +1191,9 @@ export declare class BaseClient {
|
|
|
1092
1191
|
* ```typescript
|
|
1093
1192
|
* // Example usage of the hmget method
|
|
1094
1193
|
* const result = await client.hmget("my_hash", ["field1", "field2"]);
|
|
1095
|
-
* console.log(result);
|
|
1194
|
+
* console.log(result);
|
|
1195
|
+
* // Output: ["value1", "value2"]
|
|
1196
|
+
* // A list of values associated with the specified fields.
|
|
1096
1197
|
* ```
|
|
1097
1198
|
*/
|
|
1098
1199
|
hmget(key: GlideString, fields: GlideString[], options?: DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -1108,14 +1209,18 @@ export declare class BaseClient {
|
|
|
1108
1209
|
* ```typescript
|
|
1109
1210
|
* // Example usage of the hexists method with existing field
|
|
1110
1211
|
* const result = await client.hexists("my_hash", "field1");
|
|
1111
|
-
* console.log(result);
|
|
1212
|
+
* console.log(result);
|
|
1213
|
+
* // Output: true
|
|
1214
|
+
* // Returns true because `my_hash` hash contains `field1` field.
|
|
1112
1215
|
* ```
|
|
1113
1216
|
*
|
|
1114
1217
|
* @example
|
|
1115
1218
|
* ```typescript
|
|
1116
1219
|
* // Example usage of the hexists method with non-existing field
|
|
1117
1220
|
* const result = await client.hexists("my_hash", "nonexistent_field");
|
|
1118
|
-
* console.log(result);
|
|
1221
|
+
* console.log(result);
|
|
1222
|
+
* // Output: false
|
|
1223
|
+
* // Returns false because `my_hash` hash does not contain `nonexistent_field` field.
|
|
1119
1224
|
* ```
|
|
1120
1225
|
*/
|
|
1121
1226
|
hexists(key: GlideString, field: GlideString): Promise<boolean>;
|
|
@@ -1133,7 +1238,8 @@ export declare class BaseClient {
|
|
|
1133
1238
|
* ```typescript
|
|
1134
1239
|
* // Example usage of the hgetall method
|
|
1135
1240
|
* const result = await client.hgetall("my_hash");
|
|
1136
|
-
* console.log(result);
|
|
1241
|
+
* console.log(result);
|
|
1242
|
+
* // Output: all fields and values stored at `my_hash`
|
|
1137
1243
|
* // [
|
|
1138
1244
|
* // { field: "field1", value: "value1"},
|
|
1139
1245
|
* // { field: "field2", value: "value2"}
|
|
@@ -1156,7 +1262,9 @@ export declare class BaseClient {
|
|
|
1156
1262
|
* ```typescript
|
|
1157
1263
|
* // Example usage of the hincrby method to increment the value in a hash by a specified amount
|
|
1158
1264
|
* const result = await client.hincrby("my_hash", "field1", 5);
|
|
1159
|
-
* console.log(result);
|
|
1265
|
+
* console.log(result);
|
|
1266
|
+
* // Output: 5
|
|
1267
|
+
* // Increments the value stored at hash field `field1` by 5
|
|
1160
1268
|
* ```
|
|
1161
1269
|
*/
|
|
1162
1270
|
hincrBy(key: GlideString, field: GlideString, amount: number): Promise<number>;
|
|
@@ -1175,7 +1283,9 @@ export declare class BaseClient {
|
|
|
1175
1283
|
* ```typescript
|
|
1176
1284
|
* // Example usage of the hincrbyfloat method to increment the value of a floating point in a hash by a specified amount
|
|
1177
1285
|
* const result = await client.hincrbyfloat("my_hash", "field1", 2.5);
|
|
1178
|
-
* console.log(result);
|
|
1286
|
+
* console.log(result);
|
|
1287
|
+
* // Output: 2.5
|
|
1288
|
+
* // Increments the value stored at hash field `field1` by 2.5
|
|
1179
1289
|
* ```
|
|
1180
1290
|
*/
|
|
1181
1291
|
hincrByFloat(key: GlideString, field: GlideString, amount: number): Promise<number>;
|
|
@@ -1190,14 +1300,18 @@ export declare class BaseClient {
|
|
|
1190
1300
|
* ```typescript
|
|
1191
1301
|
* // Example usage of the hlen method with an existing key
|
|
1192
1302
|
* const result = await client.hlen("my_hash");
|
|
1193
|
-
* console.log(result);
|
|
1303
|
+
* console.log(result);
|
|
1304
|
+
* // Output: 3
|
|
1305
|
+
* // Returns the number of fields for the hash stored at key `my_hash`.
|
|
1194
1306
|
* ```
|
|
1195
1307
|
*
|
|
1196
1308
|
* @example
|
|
1197
1309
|
* ```typescript
|
|
1198
1310
|
* // Example usage of the hlen method with a non-existing key
|
|
1199
1311
|
* const result = await client.hlen("non_existing_key");
|
|
1200
|
-
* console.log(result);
|
|
1312
|
+
* console.log(result);
|
|
1313
|
+
* // Output: 0
|
|
1314
|
+
* // Returns 0 for non-existent key.
|
|
1201
1315
|
* ```
|
|
1202
1316
|
*/
|
|
1203
1317
|
hlen(key: GlideString): Promise<number>;
|
|
@@ -1213,7 +1327,9 @@ export declare class BaseClient {
|
|
|
1213
1327
|
* ```typescript
|
|
1214
1328
|
* // Example usage of the hvals method
|
|
1215
1329
|
* const result = await client.hvals("my_hash");
|
|
1216
|
-
* console.log(result);
|
|
1330
|
+
* console.log(result);
|
|
1331
|
+
* // Output: ["value1", "value2", "value3"]
|
|
1332
|
+
* // Returns all the values stored in the hash `my_hash`.
|
|
1217
1333
|
* ```
|
|
1218
1334
|
*/
|
|
1219
1335
|
hvals(key: GlideString, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1230,7 +1346,9 @@ export declare class BaseClient {
|
|
|
1230
1346
|
* ```typescript
|
|
1231
1347
|
* await client.hset("my_hash", {"field": "value"});
|
|
1232
1348
|
* const result = await client.hstrlen("my_hash", "field");
|
|
1233
|
-
* 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`.
|
|
1234
1352
|
* ```
|
|
1235
1353
|
*/
|
|
1236
1354
|
hstrlen(key: GlideString, field: GlideString): Promise<number>;
|
|
@@ -1247,7 +1365,10 @@ export declare class BaseClient {
|
|
|
1247
1365
|
*
|
|
1248
1366
|
* @example
|
|
1249
1367
|
* ```typescript
|
|
1250
|
-
*
|
|
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`.
|
|
1251
1372
|
* ```
|
|
1252
1373
|
*/
|
|
1253
1374
|
hrandfield(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1281,12 +1402,13 @@ export declare class BaseClient {
|
|
|
1281
1402
|
* console.log("Members: ", result[1]);
|
|
1282
1403
|
* } while (newCursor !== "0");
|
|
1283
1404
|
* // The output of the code above is something similar to:
|
|
1284
|
-
* // Cursor: 31
|
|
1285
|
-
* // Members: ['field 79', 'value 79', 'field 20', 'value 20', 'field 115', 'value 115']
|
|
1286
|
-
* // Cursor: 39
|
|
1287
|
-
* // Members: ['field 63', 'value 63', 'field 293', 'value 293', 'field 162', 'value 162']
|
|
1288
|
-
* // 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.
|
|
1289
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.
|
|
1290
1412
|
* ```
|
|
1291
1413
|
* @example
|
|
1292
1414
|
* ```typescript
|
|
@@ -1304,12 +1426,13 @@ export declare class BaseClient {
|
|
|
1304
1426
|
* console.log("Members: ", result[1]);
|
|
1305
1427
|
* } while (newCursor !== "0");
|
|
1306
1428
|
* // The output of the code above is something similar to:
|
|
1307
|
-
* // Cursor: 31
|
|
1308
|
-
* // Members: ['field 79', 'field 20', 'field 115']
|
|
1309
|
-
* // Cursor: 39
|
|
1310
|
-
* // Members: ['field 63', 'field 293', 'field 162']
|
|
1311
|
-
* // 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.
|
|
1312
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.
|
|
1313
1436
|
* ```
|
|
1314
1437
|
*/
|
|
1315
1438
|
hscan(key: GlideString, cursor: string, options?: HScanOptions & DecoderOption): Promise<[string, GlideString[]]>;
|
|
@@ -1329,7 +1452,10 @@ export declare class BaseClient {
|
|
|
1329
1452
|
*
|
|
1330
1453
|
* @example
|
|
1331
1454
|
* ```typescript
|
|
1332
|
-
*
|
|
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`.
|
|
1333
1459
|
* ```
|
|
1334
1460
|
*/
|
|
1335
1461
|
hrandfieldCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1352,7 +1478,9 @@ export declare class BaseClient {
|
|
|
1352
1478
|
* @example
|
|
1353
1479
|
* ```typescript
|
|
1354
1480
|
* const result = await client.hrandfieldCountWithValues("myHash", 2);
|
|
1355
|
-
* 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`.
|
|
1356
1484
|
* ```
|
|
1357
1485
|
*/
|
|
1358
1486
|
hrandfieldWithValues(key: GlideString, count: number, options?: DecoderOption): Promise<[GlideString, GlideString][]>;
|
|
@@ -1370,14 +1498,18 @@ export declare class BaseClient {
|
|
|
1370
1498
|
* ```typescript
|
|
1371
1499
|
* // Example usage of the lpush method with an existing list
|
|
1372
1500
|
* const result = await client.lpush("my_list", ["value2", "value3"]);
|
|
1373
|
-
* 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.
|
|
1374
1504
|
* ```
|
|
1375
1505
|
*
|
|
1376
1506
|
* @example
|
|
1377
1507
|
* ```typescript
|
|
1378
1508
|
* // Example usage of the lpush method with a non-existing list
|
|
1379
1509
|
* const result = await client.lpush("nonexistent_list", ["new_value"]);
|
|
1380
|
-
* console.log(result);
|
|
1510
|
+
* console.log(result);
|
|
1511
|
+
* // Output: 1
|
|
1512
|
+
* // Indicates that a new list was created with one element
|
|
1381
1513
|
* ```
|
|
1382
1514
|
*/
|
|
1383
1515
|
lpush(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1392,8 +1524,10 @@ export declare class BaseClient {
|
|
|
1392
1524
|
* @returns The length of the list after the push operation.
|
|
1393
1525
|
* @example
|
|
1394
1526
|
* ```typescript
|
|
1395
|
-
* const
|
|
1396
|
-
* 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.
|
|
1397
1531
|
* ```
|
|
1398
1532
|
*/
|
|
1399
1533
|
lpushx(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1411,14 +1545,18 @@ export declare class BaseClient {
|
|
|
1411
1545
|
* ```typescript
|
|
1412
1546
|
* // Example usage of the lpop method with an existing list
|
|
1413
1547
|
* const result = await client.lpop("my_list");
|
|
1414
|
-
* console.log(result);
|
|
1548
|
+
* console.log(result);
|
|
1549
|
+
* // Output: 'value1'
|
|
1550
|
+
* // Returns and removes the first element of the list `value1`.
|
|
1415
1551
|
* ```
|
|
1416
1552
|
*
|
|
1417
1553
|
* @example
|
|
1418
1554
|
* ```typescript
|
|
1419
1555
|
* // Example usage of the lpop method with a non-existing list
|
|
1420
1556
|
* const result = await client.lpop("non_exiting_key");
|
|
1421
|
-
* console.log(result);
|
|
1557
|
+
* console.log(result);
|
|
1558
|
+
* // Output: null
|
|
1559
|
+
* // Returns null for non-existent key.
|
|
1422
1560
|
* ```
|
|
1423
1561
|
*/
|
|
1424
1562
|
lpop(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1436,14 +1574,18 @@ export declare class BaseClient {
|
|
|
1436
1574
|
* ```typescript
|
|
1437
1575
|
* // Example usage of the lpopCount method with an existing list
|
|
1438
1576
|
* const result = await client.lpopCount("my_list", 2);
|
|
1439
|
-
* console.log(result);
|
|
1577
|
+
* console.log(result);
|
|
1578
|
+
* // Output: ["value1", "value2"]
|
|
1579
|
+
* // Returns and removes 2 elements from the list.
|
|
1440
1580
|
* ```
|
|
1441
1581
|
*
|
|
1442
1582
|
* @example
|
|
1443
1583
|
* ```typescript
|
|
1444
1584
|
* // Example usage of the lpopCount method with a non-existing list
|
|
1445
1585
|
* const result = await client.lpopCount("non_exiting_key", 3);
|
|
1446
|
-
* console.log(result);
|
|
1586
|
+
* console.log(result);
|
|
1587
|
+
* // Output: null
|
|
1588
|
+
* // Returns null in case of non-existent key.
|
|
1447
1589
|
* ```
|
|
1448
1590
|
*/
|
|
1449
1591
|
lpopCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[] | null>;
|
|
@@ -1467,21 +1609,27 @@ export declare class BaseClient {
|
|
|
1467
1609
|
* ```typescript
|
|
1468
1610
|
* // Example usage of the lrange method with an existing list and positive indices
|
|
1469
1611
|
* const result = await client.lrange("my_list", 0, 2);
|
|
1470
|
-
* console.log(result);
|
|
1612
|
+
* console.log(result);
|
|
1613
|
+
* // Output: ["value1", "value2", "value3"]
|
|
1614
|
+
* // Returns the first 3 elements of the list.
|
|
1471
1615
|
* ```
|
|
1472
1616
|
*
|
|
1473
1617
|
* @example
|
|
1474
1618
|
* ```typescript
|
|
1475
1619
|
* // Example usage of the lrange method with an existing list and negative indices
|
|
1476
1620
|
* const result = await client.lrange("my_list", -2, -1);
|
|
1477
|
-
* console.log(result);
|
|
1621
|
+
* console.log(result);
|
|
1622
|
+
* // Output: ["value2", "value3"]
|
|
1623
|
+
* // Returns the last 2 elements of the list.
|
|
1478
1624
|
* ```
|
|
1479
1625
|
*
|
|
1480
1626
|
* @example
|
|
1481
1627
|
* ```typescript
|
|
1482
1628
|
* // Example usage of the lrange method with a non-existing list
|
|
1483
1629
|
* const result = await client.lrange("non_exiting_key", 0, 2);
|
|
1484
|
-
* console.log(result);
|
|
1630
|
+
* console.log(result);
|
|
1631
|
+
* // Output: []
|
|
1632
|
+
* // Returns an empty list for non-existent key.
|
|
1485
1633
|
* ```
|
|
1486
1634
|
*/
|
|
1487
1635
|
lrange(key: GlideString, start: number, end: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -1497,7 +1645,9 @@ export declare class BaseClient {
|
|
|
1497
1645
|
* ```typescript
|
|
1498
1646
|
* // Example usage of the llen method
|
|
1499
1647
|
* const result = await client.llen("my_list");
|
|
1500
|
-
* console.log(result);
|
|
1648
|
+
* console.log(result);
|
|
1649
|
+
* // Output: 3
|
|
1650
|
+
* // Indicates that there are 3 elements in the list.
|
|
1501
1651
|
* ```
|
|
1502
1652
|
*/
|
|
1503
1653
|
llen(key: GlideString): Promise<number>;
|
|
@@ -1518,17 +1668,23 @@ export declare class BaseClient {
|
|
|
1518
1668
|
*
|
|
1519
1669
|
* @example
|
|
1520
1670
|
* ```typescript
|
|
1521
|
-
* await client.lpush("testKey1", ["two", "one"]);
|
|
1522
|
-
* 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.
|
|
1523
1673
|
*
|
|
1524
|
-
* const
|
|
1525
|
-
* 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`.
|
|
1526
1678
|
*
|
|
1527
1679
|
* const updated_array_key1 = await client.lrange("testKey1", 0, -1);
|
|
1528
|
-
* console.log(
|
|
1680
|
+
* console.log(updated_array_key1);
|
|
1681
|
+
* // Output: ["two"]
|
|
1682
|
+
* // The elements in the list at `testKey1` after lmove command.
|
|
1529
1683
|
*
|
|
1530
1684
|
* const updated_array_key2 = await client.lrange("testKey2", 0, -1);
|
|
1531
|
-
* 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.
|
|
1532
1688
|
* ```
|
|
1533
1689
|
*/
|
|
1534
1690
|
lmove(source: GlideString, destination: GlideString, whereFrom: ListDirection, whereTo: ListDirection, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1553,16 +1709,22 @@ export declare class BaseClient {
|
|
|
1553
1709
|
*
|
|
1554
1710
|
* @example
|
|
1555
1711
|
* ```typescript
|
|
1556
|
-
* await client.lpush("testKey1", ["two", "one"]);
|
|
1557
|
-
* 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.
|
|
1558
1714
|
* const result = await client.blmove("testKey1", "testKey2", ListDirection.LEFT, ListDirection.LEFT, 0.1);
|
|
1559
|
-
* 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`.
|
|
1560
1718
|
*
|
|
1561
|
-
* const
|
|
1562
|
-
* 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.
|
|
1563
1723
|
*
|
|
1564
1724
|
* const updated_array2 = await client.lrange("testKey2", 0, -1);
|
|
1565
|
-
* 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.
|
|
1566
1728
|
* ```
|
|
1567
1729
|
*/
|
|
1568
1730
|
blmove(source: GlideString, destination: GlideString, whereFrom: ListDirection, whereTo: ListDirection, timeout: number, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1582,8 +1744,10 @@ export declare class BaseClient {
|
|
|
1582
1744
|
* @example
|
|
1583
1745
|
* ```typescript
|
|
1584
1746
|
* // Example usage of the lset method
|
|
1585
|
-
* const
|
|
1586
|
-
* 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".
|
|
1587
1751
|
* ```
|
|
1588
1752
|
*/
|
|
1589
1753
|
lset(key: GlideString, index: number, element: GlideString): Promise<"OK">;
|
|
@@ -1598,7 +1762,7 @@ export declare class BaseClient {
|
|
|
1598
1762
|
* @param start - The starting point of the range.
|
|
1599
1763
|
* @param end - The end of the range.
|
|
1600
1764
|
* @returns always "OK".
|
|
1601
|
-
* If `start` exceeds the end of the list, or if `start` is greater than `end`, the
|
|
1765
|
+
* If `start` exceeds the end of the list, or if `start` is greater than `end`, the list is emptied and the key is removed.
|
|
1602
1766
|
* If `end` exceeds the actual end of the list, it will be treated like the last element of the list.
|
|
1603
1767
|
* If `key` does not exist the command will be ignored.
|
|
1604
1768
|
*
|
|
@@ -1606,17 +1770,19 @@ export declare class BaseClient {
|
|
|
1606
1770
|
* ```typescript
|
|
1607
1771
|
* // Example usage of the ltrim method
|
|
1608
1772
|
* const result = await client.ltrim("my_list", 0, 1);
|
|
1609
|
-
* 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.
|
|
1610
1776
|
* ```
|
|
1611
1777
|
*/
|
|
1612
1778
|
ltrim(key: GlideString, start: number, end: number): Promise<"OK">;
|
|
1613
1779
|
/** Removes the first `count` occurrences of elements equal to `element` from the list stored at `key`.
|
|
1614
|
-
* If `count` is positive : Removes elements equal to `element` moving from head to tail.
|
|
1615
|
-
* If `count` is negative : Removes elements equal to `element` moving from tail to head.
|
|
1616
|
-
* If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
|
|
1617
1780
|
*
|
|
1618
1781
|
* @param key - The key of the list.
|
|
1619
1782
|
* @param count - The count of the occurrences of elements equal to `element` to remove.
|
|
1783
|
+
* If `count` is positive : Removes elements equal to `element` moving from head to tail.
|
|
1784
|
+
* If `count` is negative : Removes elements equal to `element` moving from tail to head.
|
|
1785
|
+
* If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
|
|
1620
1786
|
* @param element - The element to remove from the list.
|
|
1621
1787
|
* @returns the number of the removed elements.
|
|
1622
1788
|
* If `key` does not exist, 0 is returned.
|
|
@@ -1625,7 +1791,9 @@ export declare class BaseClient {
|
|
|
1625
1791
|
* ```typescript
|
|
1626
1792
|
* // Example usage of the lrem method
|
|
1627
1793
|
* const result = await client.lrem("my_list", 2, "value");
|
|
1628
|
-
* console.log(result);
|
|
1794
|
+
* console.log(result);
|
|
1795
|
+
* // Output: 2
|
|
1796
|
+
* // Removes the first 2 occurrences of "value" in the list.
|
|
1629
1797
|
* ```
|
|
1630
1798
|
*/
|
|
1631
1799
|
lrem(key: GlideString, count: number, element: GlideString): Promise<number>;
|
|
@@ -1643,14 +1811,17 @@ export declare class BaseClient {
|
|
|
1643
1811
|
* ```typescript
|
|
1644
1812
|
* // Example usage of the rpush method with an existing list
|
|
1645
1813
|
* const result = await client.rpush("my_list", ["value2", "value3"]);
|
|
1646
|
-
* 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.
|
|
1647
1817
|
* ```
|
|
1648
1818
|
*
|
|
1649
1819
|
* @example
|
|
1650
1820
|
* ```typescript
|
|
1651
1821
|
* // Example usage of the rpush method with a non-existing list
|
|
1652
1822
|
* const result = await client.rpush("nonexistent_list", ["new_value"]);
|
|
1653
|
-
* console.log(result);
|
|
1823
|
+
* console.log(result);
|
|
1824
|
+
* // Output: 1
|
|
1654
1825
|
* ```
|
|
1655
1826
|
*/
|
|
1656
1827
|
rpush(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1666,7 +1837,9 @@ export declare class BaseClient {
|
|
|
1666
1837
|
* @example
|
|
1667
1838
|
* ```typescript
|
|
1668
1839
|
* const result = await client.rpushx("my_list", ["value1", "value2"]);
|
|
1669
|
-
* console.log(result);
|
|
1840
|
+
* console.log(result);
|
|
1841
|
+
* // Output: 2
|
|
1842
|
+
* // Indicates that the list has two elements.
|
|
1670
1843
|
* ```
|
|
1671
1844
|
* */
|
|
1672
1845
|
rpushx(key: GlideString, elements: GlideString[]): Promise<number>;
|
|
@@ -1684,14 +1857,18 @@ export declare class BaseClient {
|
|
|
1684
1857
|
* ```typescript
|
|
1685
1858
|
* // Example usage of the rpop method with an existing list
|
|
1686
1859
|
* const result = await client.rpop("my_list");
|
|
1687
|
-
* console.log(result);
|
|
1860
|
+
* console.log(result);
|
|
1861
|
+
* // Output: 'value1'
|
|
1862
|
+
* // Returns and removes the last element of the list stored at `my_list`.
|
|
1688
1863
|
* ```
|
|
1689
1864
|
*
|
|
1690
1865
|
* @example
|
|
1691
1866
|
* ```typescript
|
|
1692
1867
|
* // Example usage of the rpop method with a non-existing list
|
|
1693
1868
|
* const result = await client.rpop("non_exiting_key");
|
|
1694
|
-
* console.log(result);
|
|
1869
|
+
* console.log(result);
|
|
1870
|
+
* // Output: null
|
|
1871
|
+
* // Returns null for non-existent key.
|
|
1695
1872
|
* ```
|
|
1696
1873
|
*/
|
|
1697
1874
|
rpop(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -1709,14 +1886,18 @@ export declare class BaseClient {
|
|
|
1709
1886
|
* ```typescript
|
|
1710
1887
|
* // Example usage of the rpopCount method with an existing list
|
|
1711
1888
|
* const result = await client.rpopCount("my_list", 2);
|
|
1712
|
-
* 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`.
|
|
1713
1892
|
* ```
|
|
1714
1893
|
*
|
|
1715
1894
|
* @example
|
|
1716
1895
|
* ```typescript
|
|
1717
1896
|
* // Example usage of the rpopCount method with a non-existing list
|
|
1718
1897
|
* const result = await client.rpopCount("non_exiting_key", 7);
|
|
1719
|
-
* console.log(result);
|
|
1898
|
+
* console.log(result);
|
|
1899
|
+
* // Output: null
|
|
1900
|
+
* // Returns null for a non-existing key.
|
|
1720
1901
|
* ```
|
|
1721
1902
|
*/
|
|
1722
1903
|
rpopCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[] | null>;
|
|
@@ -1733,7 +1914,9 @@ export declare class BaseClient {
|
|
|
1733
1914
|
* ```typescript
|
|
1734
1915
|
* // Example usage of the sadd method with an existing set
|
|
1735
1916
|
* const result = await client.sadd("my_set", ["member1", "member2"]);
|
|
1736
|
-
* console.log(result);
|
|
1917
|
+
* console.log(result);
|
|
1918
|
+
* // Output: 2
|
|
1919
|
+
* // Adds 2 members to the set at key `my_set`
|
|
1737
1920
|
* ```
|
|
1738
1921
|
*/
|
|
1739
1922
|
sadd(key: GlideString, members: GlideString[]): Promise<number>;
|
|
@@ -1750,7 +1933,9 @@ export declare class BaseClient {
|
|
|
1750
1933
|
* ```typescript
|
|
1751
1934
|
* // Example usage of the srem method
|
|
1752
1935
|
* const result = await client.srem("my_set", ["member1", "member2"]);
|
|
1753
|
-
* console.log(result);
|
|
1936
|
+
* console.log(result);
|
|
1937
|
+
* // Output: 2
|
|
1938
|
+
* // Removes `member1` and `member2` from the set at key `my_set`.
|
|
1754
1939
|
* ```
|
|
1755
1940
|
*/
|
|
1756
1941
|
srem(key: GlideString, members: GlideString[]): Promise<number>;
|
|
@@ -1804,7 +1989,8 @@ export declare class BaseClient {
|
|
|
1804
1989
|
* ```typescript
|
|
1805
1990
|
* // Example usage of the smembers method
|
|
1806
1991
|
* const result = await client.smembers("my_set");
|
|
1807
|
-
* console.log(result);
|
|
1992
|
+
* console.log(result);
|
|
1993
|
+
* // Output: Set(3) {'member1', 'member2', 'member3'}
|
|
1808
1994
|
* ```
|
|
1809
1995
|
*/
|
|
1810
1996
|
smembers(key: GlideString, options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -1822,7 +2008,9 @@ export declare class BaseClient {
|
|
|
1822
2008
|
* @example
|
|
1823
2009
|
* ```typescript
|
|
1824
2010
|
* const result = await client.smove("set1", "set2", "member1");
|
|
1825
|
-
* console.log(result);
|
|
2011
|
+
* console.log(result);
|
|
2012
|
+
* // Output: true
|
|
2013
|
+
* // `member1` was moved from `set1` to `set2`.
|
|
1826
2014
|
* ```
|
|
1827
2015
|
*/
|
|
1828
2016
|
smove(source: GlideString, destination: GlideString, member: GlideString): Promise<boolean>;
|
|
@@ -1837,7 +2025,8 @@ export declare class BaseClient {
|
|
|
1837
2025
|
* ```typescript
|
|
1838
2026
|
* // Example usage of the scard method
|
|
1839
2027
|
* const result = await client.scard("my_set");
|
|
1840
|
-
* console.log(result);
|
|
2028
|
+
* console.log(result);
|
|
2029
|
+
* // Output: 3
|
|
1841
2030
|
* ```
|
|
1842
2031
|
*/
|
|
1843
2032
|
scard(key: GlideString): Promise<number>;
|
|
@@ -1855,14 +2044,18 @@ export declare class BaseClient {
|
|
|
1855
2044
|
* ```typescript
|
|
1856
2045
|
* // Example usage of sinter method when member exists
|
|
1857
2046
|
* const result = await client.sinter(["my_set1", "my_set2"]);
|
|
1858
|
-
* console.log(result);
|
|
2047
|
+
* console.log(result);
|
|
2048
|
+
* // Output: Set(1) {'member2'}
|
|
2049
|
+
* // Indicates that sets have one common member
|
|
1859
2050
|
* ```
|
|
1860
2051
|
*
|
|
1861
2052
|
* @example
|
|
1862
2053
|
* ```typescript
|
|
1863
2054
|
* // Example usage of sinter method with non-existing key
|
|
1864
2055
|
* const result = await client.sinter(["my_set", "non_existing_key"]);
|
|
1865
|
-
* console.log(result);
|
|
2056
|
+
* console.log(result);
|
|
2057
|
+
* // Output: Set(0) {}
|
|
2058
|
+
* // An empty set is returned since the key does not exist.
|
|
1866
2059
|
* ```
|
|
1867
2060
|
*/
|
|
1868
2061
|
sinter(keys: GlideString[], options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -1883,10 +2076,14 @@ export declare class BaseClient {
|
|
|
1883
2076
|
* await client.sadd("set1", ["a", "b", "c"]);
|
|
1884
2077
|
* await client.sadd("set2", ["b", "c", "d"]);
|
|
1885
2078
|
* const result1 = await client.sintercard(["set1", "set2"]);
|
|
1886
|
-
* console.log(result1);
|
|
2079
|
+
* console.log(result1);
|
|
2080
|
+
* // Output: 2
|
|
2081
|
+
* // The intersection of `set1` and `set2` contains 2 elements: `b` and `c`.
|
|
1887
2082
|
*
|
|
1888
2083
|
* const result2 = await client.sintercard(["set1", "set2"], { limit: 1 });
|
|
1889
|
-
* console.log(result2);
|
|
2084
|
+
* console.log(result2);
|
|
2085
|
+
* // Output: 1
|
|
2086
|
+
* // The computation stops early as the intersection cardinality reaches the limit of 1.
|
|
1890
2087
|
* ```
|
|
1891
2088
|
*/
|
|
1892
2089
|
sintercard(keys: GlideString[], options?: {
|
|
@@ -1905,7 +2102,9 @@ export declare class BaseClient {
|
|
|
1905
2102
|
* @example
|
|
1906
2103
|
* ```typescript
|
|
1907
2104
|
* const result = await client.sinterstore("my_set", ["set1", "set2"]);
|
|
1908
|
-
* 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`.
|
|
1909
2108
|
* ```
|
|
1910
2109
|
*/
|
|
1911
2110
|
sinterstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -1925,7 +2124,9 @@ export declare class BaseClient {
|
|
|
1925
2124
|
* await client.sadd("set1", ["member1", "member2"]);
|
|
1926
2125
|
* await client.sadd("set2", ["member1"]);
|
|
1927
2126
|
* const result = await client.sdiff(["set1", "set2"]);
|
|
1928
|
-
* console.log(result);
|
|
2127
|
+
* console.log(result);
|
|
2128
|
+
* // Output: Set(1) {"member1"}
|
|
2129
|
+
* // `member2` is in `set1` but not `set2`
|
|
1929
2130
|
* ```
|
|
1930
2131
|
*/
|
|
1931
2132
|
sdiff(keys: GlideString[], options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -1944,7 +2145,9 @@ export declare class BaseClient {
|
|
|
1944
2145
|
* await client.sadd("set1", ["member1", "member2"]);
|
|
1945
2146
|
* await client.sadd("set2", ["member1"]);
|
|
1946
2147
|
* const result = await client.sdiffstore("set3", ["set1", "set2"]);
|
|
1947
|
-
* 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`.
|
|
1948
2151
|
* ```
|
|
1949
2152
|
*/
|
|
1950
2153
|
sdiffstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -1964,10 +2167,13 @@ export declare class BaseClient {
|
|
|
1964
2167
|
* await client.sadd("my_set1", ["member1", "member2"]);
|
|
1965
2168
|
* await client.sadd("my_set2", ["member2", "member3"]);
|
|
1966
2169
|
* const result1 = await client.sunion(["my_set1", "my_set2"]);
|
|
1967
|
-
* 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.
|
|
1968
2173
|
*
|
|
1969
2174
|
* const result2 = await client.sunion(["my_set1", "non_existing_set"]);
|
|
1970
|
-
* console.log(result2);
|
|
2175
|
+
* console.log(result2);
|
|
2176
|
+
* // Output: Set(2) {'member1', 'member2'}
|
|
1971
2177
|
* ```
|
|
1972
2178
|
*/
|
|
1973
2179
|
sunion(keys: GlideString[], options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -1985,7 +2191,9 @@ export declare class BaseClient {
|
|
|
1985
2191
|
* @example
|
|
1986
2192
|
* ```typescript
|
|
1987
2193
|
* const length = await client.sunionstore("mySet", ["set1", "set2"]);
|
|
1988
|
-
* 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`.
|
|
1989
2197
|
* ```
|
|
1990
2198
|
*/
|
|
1991
2199
|
sunionstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -2002,14 +2210,18 @@ export declare class BaseClient {
|
|
|
2002
2210
|
* ```typescript
|
|
2003
2211
|
* // Example usage of the sismember method when member exists
|
|
2004
2212
|
* const result = await client.sismember("my_set", "member1");
|
|
2005
|
-
* console.log(result);
|
|
2213
|
+
* console.log(result);
|
|
2214
|
+
* // Output: true
|
|
2215
|
+
* // Indicates that `member1` exists in the set `my_set`.
|
|
2006
2216
|
* ```
|
|
2007
2217
|
*
|
|
2008
2218
|
* @example
|
|
2009
2219
|
* ```typescript
|
|
2010
2220
|
* // Example usage of the sismember method when member does not exist
|
|
2011
2221
|
* const result = await client.sismember("my_set", "non_existing_member");
|
|
2012
|
-
* console.log(result);
|
|
2222
|
+
* console.log(result);
|
|
2223
|
+
* // Output: false
|
|
2224
|
+
* // Indicates that `non_existing_member` does not exist in the set `my_set`.
|
|
2013
2225
|
* ```
|
|
2014
2226
|
*/
|
|
2015
2227
|
sismember(key: GlideString, member: GlideString): Promise<boolean>;
|
|
@@ -2027,7 +2239,9 @@ export declare class BaseClient {
|
|
|
2027
2239
|
* ```typescript
|
|
2028
2240
|
* await client.sadd("set1", ["a", "b", "c"]);
|
|
2029
2241
|
* const result = await client.smismember("set1", ["b", "c", "d"]);
|
|
2030
|
-
* console.log(result);
|
|
2242
|
+
* console.log(result);
|
|
2243
|
+
* // Output: [true, true, false]
|
|
2244
|
+
* // `b` and `c` are members of `set1`, but `d` is not.
|
|
2031
2245
|
* ```
|
|
2032
2246
|
*/
|
|
2033
2247
|
smismember(key: GlideString, members: GlideString[]): Promise<boolean[]>;
|
|
@@ -2045,14 +2259,17 @@ export declare class BaseClient {
|
|
|
2045
2259
|
* ```typescript
|
|
2046
2260
|
* // Example usage of spop method to remove and return a random member from a set
|
|
2047
2261
|
* const result = await client.spop("my_set");
|
|
2048
|
-
* console.log(result);
|
|
2262
|
+
* console.log(result);
|
|
2263
|
+
* // Output: 'member1'
|
|
2264
|
+
* // Removes and returns a random member from the set `my_set`.
|
|
2049
2265
|
* ```
|
|
2050
2266
|
*
|
|
2051
2267
|
* @example
|
|
2052
2268
|
* ```typescript
|
|
2053
2269
|
* // Example usage of spop method with non-existing key
|
|
2054
2270
|
* const result = await client.spop("non_existing_key");
|
|
2055
|
-
* console.log(result);
|
|
2271
|
+
* console.log(result);
|
|
2272
|
+
* // Output: null
|
|
2056
2273
|
* ```
|
|
2057
2274
|
*/
|
|
2058
2275
|
spop(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -2070,14 +2287,18 @@ export declare class BaseClient {
|
|
|
2070
2287
|
* ```typescript
|
|
2071
2288
|
* // Example usage of spopCount method to remove and return multiple random members from a set
|
|
2072
2289
|
* const result = await client.spopCount("my_set", 2);
|
|
2073
|
-
* 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`.
|
|
2074
2293
|
* ```
|
|
2075
2294
|
*
|
|
2076
2295
|
* @example
|
|
2077
2296
|
* ```typescript
|
|
2078
2297
|
* // Example usage of spopCount method with non-existing key
|
|
2079
2298
|
* const result = await client.spopCount("non_existing_key");
|
|
2080
|
-
* console.log(result);
|
|
2299
|
+
* console.log(result);
|
|
2300
|
+
* // Output: Set(0) {}
|
|
2301
|
+
* // An empty set is returned since the key does not exist.
|
|
2081
2302
|
* ```
|
|
2082
2303
|
*/
|
|
2083
2304
|
spopCount(key: GlideString, count: number, options?: DecoderOption): Promise<Set<GlideString>>;
|
|
@@ -2094,14 +2315,17 @@ export declare class BaseClient {
|
|
|
2094
2315
|
* ```typescript
|
|
2095
2316
|
* // Example usage of srandmember method to return a random member from a set
|
|
2096
2317
|
* const result = await client.srandmember("my_set");
|
|
2097
|
-
* console.log(result);
|
|
2318
|
+
* console.log(result);
|
|
2319
|
+
* // Output: 'member1'
|
|
2320
|
+
* // A random member of `my_set`.
|
|
2098
2321
|
* ```
|
|
2099
2322
|
*
|
|
2100
2323
|
* @example
|
|
2101
2324
|
* ```typescript
|
|
2102
2325
|
* // Example usage of srandmember method with non-existing key
|
|
2103
2326
|
* const result = await client.srandmember("non_existing_set");
|
|
2104
|
-
* console.log(result);
|
|
2327
|
+
* console.log(result);
|
|
2328
|
+
* // Output: null
|
|
2105
2329
|
* ```
|
|
2106
2330
|
*/
|
|
2107
2331
|
srandmember(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -2121,14 +2345,18 @@ export declare class BaseClient {
|
|
|
2121
2345
|
* ```typescript
|
|
2122
2346
|
* // Example usage of srandmemberCount method to return multiple random members from a set
|
|
2123
2347
|
* const result = await client.srandmemberCount("my_set", -3);
|
|
2124
|
-
* console.log(result);
|
|
2348
|
+
* console.log(result);
|
|
2349
|
+
* // Output: ['member1', 'member1', 'member2']
|
|
2350
|
+
* // Random members of `my_set`.
|
|
2125
2351
|
* ```
|
|
2126
2352
|
*
|
|
2127
2353
|
* @example
|
|
2128
2354
|
* ```typescript
|
|
2129
2355
|
* // Example usage of srandmemberCount method with non-existing key
|
|
2130
2356
|
* const result = await client.srandmemberCount("non_existing_set", 3);
|
|
2131
|
-
* console.log(result);
|
|
2357
|
+
* console.log(result);
|
|
2358
|
+
* // Output: []
|
|
2359
|
+
* // An empty list since the key does not exist.
|
|
2132
2360
|
* ```
|
|
2133
2361
|
*/
|
|
2134
2362
|
srandmemberCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -2153,7 +2381,9 @@ export declare class BaseClient {
|
|
|
2153
2381
|
* ```typescript
|
|
2154
2382
|
* // Example usage of the exists method
|
|
2155
2383
|
* const result = await client.exists(["key1", "key2", "key3"]);
|
|
2156
|
-
* console.log(result);
|
|
2384
|
+
* console.log(result);
|
|
2385
|
+
* // Output: 3
|
|
2386
|
+
* // Indicates that all three keys exist in the database.
|
|
2157
2387
|
* ```
|
|
2158
2388
|
*/
|
|
2159
2389
|
exists(keys: GlideString[]): Promise<number>;
|
|
@@ -2179,7 +2409,9 @@ export declare class BaseClient {
|
|
|
2179
2409
|
* ```typescript
|
|
2180
2410
|
* // Example usage of the unlink method
|
|
2181
2411
|
* const result = await client.unlink(["key1", "key2", "key3"]);
|
|
2182
|
-
* console.log(result);
|
|
2412
|
+
* console.log(result);
|
|
2413
|
+
* // Output: 3
|
|
2414
|
+
* // Indicates that all three keys were unlinked from the database.
|
|
2183
2415
|
* ```
|
|
2184
2416
|
*/
|
|
2185
2417
|
unlink(keys: GlideString[]): Promise<number>;
|
|
@@ -2202,14 +2434,18 @@ export declare class BaseClient {
|
|
|
2202
2434
|
* ```typescript
|
|
2203
2435
|
* // Example usage of the expire method
|
|
2204
2436
|
* const result = await client.expire("my_key", 60);
|
|
2205
|
-
* console.log(result);
|
|
2437
|
+
* console.log(result);
|
|
2438
|
+
* // Output: true
|
|
2439
|
+
* // Indicates that a timeout of 60 seconds has been set for `my_key`.
|
|
2206
2440
|
* ```
|
|
2207
2441
|
*
|
|
2208
2442
|
* @example
|
|
2209
2443
|
* ```typescript
|
|
2210
2444
|
* // Example usage of the expire method with exisiting expiry
|
|
2211
2445
|
* const result = await client.expire("my_key", 60, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2212
|
-
* console.log(result);
|
|
2446
|
+
* console.log(result);
|
|
2447
|
+
* // Output: false
|
|
2448
|
+
* // Indicates that `my_key` has an existing expiry.
|
|
2213
2449
|
* ```
|
|
2214
2450
|
*/
|
|
2215
2451
|
expire(key: GlideString, seconds: number, options?: {
|
|
@@ -2234,7 +2470,9 @@ export declare class BaseClient {
|
|
|
2234
2470
|
* ```typescript
|
|
2235
2471
|
* // Example usage of the expireAt method on a key with no previous expiry
|
|
2236
2472
|
* const result = await client.expireAt("my_key", 1672531200, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2237
|
-
* console.log(result);
|
|
2473
|
+
* console.log(result);
|
|
2474
|
+
* // Output: true
|
|
2475
|
+
* // Indicates that the expiration time for `my_key` was successfully set.
|
|
2238
2476
|
* ```
|
|
2239
2477
|
*/
|
|
2240
2478
|
expireAt(key: GlideString, unixSeconds: number, options?: {
|
|
@@ -2253,15 +2491,21 @@ export declare class BaseClient {
|
|
|
2253
2491
|
* @example
|
|
2254
2492
|
* ```typescript
|
|
2255
2493
|
* const result1 = await client.expiretime("myKey");
|
|
2256
|
-
* console.log(result1);
|
|
2494
|
+
* console.log(result1);
|
|
2495
|
+
* // Output: -2
|
|
2496
|
+
* // `myKey` doesn't exist.
|
|
2257
2497
|
*
|
|
2258
|
-
* const result2 = await client.set(myKey, "value");
|
|
2259
|
-
* const result3 = await client.expireTime(myKey);
|
|
2260
|
-
* 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.
|
|
2261
2503
|
*
|
|
2262
2504
|
* client.expire(myKey, 60);
|
|
2263
|
-
* const result3 = await client.expireTime(myKey);
|
|
2264
|
-
* 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.
|
|
2265
2509
|
* ```
|
|
2266
2510
|
*/
|
|
2267
2511
|
expiretime(key: GlideString): Promise<number>;
|
|
@@ -2284,7 +2528,9 @@ export declare class BaseClient {
|
|
|
2284
2528
|
* ```typescript
|
|
2285
2529
|
* // Example usage of the pexpire method on a key with no previous expiry
|
|
2286
2530
|
* const result = await client.pexpire("my_key", 60000, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2287
|
-
* 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`.
|
|
2288
2534
|
* ```
|
|
2289
2535
|
*/
|
|
2290
2536
|
pexpire(key: GlideString, milliseconds: number, options?: {
|
|
@@ -2309,7 +2555,9 @@ export declare class BaseClient {
|
|
|
2309
2555
|
* ```typescript
|
|
2310
2556
|
* // Example usage of the pexpireAt method on a key with no previous expiry
|
|
2311
2557
|
* const result = await client.pexpireAt("my_key", 1672531200000, { expireOption: ExpireOptions.HasNoExpiry });
|
|
2312
|
-
* console.log(result);
|
|
2558
|
+
* console.log(result);
|
|
2559
|
+
* // Output: true
|
|
2560
|
+
* // Indicates that the expiration time for `my_key` was successfully set.
|
|
2313
2561
|
* ```
|
|
2314
2562
|
*/
|
|
2315
2563
|
pexpireAt(key: GlideString, unixMilliseconds: number, options?: {
|
|
@@ -2327,15 +2575,21 @@ export declare class BaseClient {
|
|
|
2327
2575
|
* @example
|
|
2328
2576
|
* ```typescript
|
|
2329
2577
|
* const result1 = client.pexpiretime("myKey");
|
|
2330
|
-
* console.log(result1);
|
|
2578
|
+
* console.log(result1);
|
|
2579
|
+
* // Output: -2
|
|
2580
|
+
* // `myKey` doesn't exist.
|
|
2331
2581
|
*
|
|
2332
2582
|
* const result2 = client.set(myKey, "value");
|
|
2333
2583
|
* const result3 = client.pexpireTime(myKey);
|
|
2334
|
-
* console.log(result2);
|
|
2584
|
+
* console.log(result2);
|
|
2585
|
+
* // Output: -1
|
|
2586
|
+
* // `myKey` has no associated expiration.
|
|
2335
2587
|
*
|
|
2336
2588
|
* client.expire(myKey, 60);
|
|
2337
2589
|
* const result3 = client.pexpireTime(myKey);
|
|
2338
|
-
* console.log(result3);
|
|
2590
|
+
* console.log(result3);
|
|
2591
|
+
* // Output: 123456789
|
|
2592
|
+
* // The Unix timestamp (in milliseconds) when `myKey` will expire.
|
|
2339
2593
|
* ```
|
|
2340
2594
|
*/
|
|
2341
2595
|
pexpiretime(key: GlideString): Promise<number>;
|
|
@@ -2351,21 +2605,27 @@ export declare class BaseClient {
|
|
|
2351
2605
|
* ```typescript
|
|
2352
2606
|
* // Example usage of the ttl method with existing key
|
|
2353
2607
|
* const result = await client.ttl("my_key");
|
|
2354
|
-
* console.log(result);
|
|
2608
|
+
* console.log(result);
|
|
2609
|
+
* // Output: 3600
|
|
2610
|
+
* // Indicates that `my_key` has a remaining time to live of 3600 seconds.
|
|
2355
2611
|
* ```
|
|
2356
2612
|
*
|
|
2357
2613
|
* @example
|
|
2358
2614
|
* ```typescript
|
|
2359
2615
|
* // Example usage of the ttl method with existing key that has no associated expire.
|
|
2360
2616
|
* const result = await client.ttl("key");
|
|
2361
|
-
* console.log(result);
|
|
2617
|
+
* console.log(result);
|
|
2618
|
+
* // Output: -1
|
|
2619
|
+
* // Indicates that the key has no associated expire.
|
|
2362
2620
|
* ```
|
|
2363
2621
|
*
|
|
2364
2622
|
* @example
|
|
2365
2623
|
* ```typescript
|
|
2366
2624
|
* // Example usage of the ttl method with a non-existing key
|
|
2367
2625
|
* const result = await client.ttl("nonexistent_key");
|
|
2368
|
-
* console.log(result);
|
|
2626
|
+
* console.log(result);
|
|
2627
|
+
* // Output: -2
|
|
2628
|
+
* // Indicates that the key doesn't exist.
|
|
2369
2629
|
* ```
|
|
2370
2630
|
*/
|
|
2371
2631
|
ttl(key: GlideString): Promise<number>;
|
|
@@ -2393,7 +2653,9 @@ export declare class BaseClient {
|
|
|
2393
2653
|
* args: ["bar"],
|
|
2394
2654
|
* };
|
|
2395
2655
|
* const result = await invokeScript(luaScript, scriptOptions);
|
|
2396
|
-
* console.log(result);
|
|
2656
|
+
* console.log(result);
|
|
2657
|
+
* // Output: ['foo', 'bar']
|
|
2658
|
+
* // The result for the script.
|
|
2397
2659
|
* ```
|
|
2398
2660
|
*/
|
|
2399
2661
|
invokeScript(script: Script, options?: {
|
|
@@ -2415,7 +2677,9 @@ export declare class BaseClient {
|
|
|
2415
2677
|
* ```typescript
|
|
2416
2678
|
* const scriptHash = script.getHash();
|
|
2417
2679
|
* const scriptSource = await client.scriptShow(scriptHash);
|
|
2418
|
-
* console.log(scriptSource);
|
|
2680
|
+
* console.log(scriptSource);
|
|
2681
|
+
* // Output: "return { KEYS[1], ARGV[1] }"
|
|
2682
|
+
* // The source for the script
|
|
2419
2683
|
* ```
|
|
2420
2684
|
*/
|
|
2421
2685
|
scriptShow(sha1: GlideString, options?: DecoderOption): Promise<GlideString>;
|
|
@@ -2448,7 +2712,8 @@ export declare class BaseClient {
|
|
|
2448
2712
|
* // {
|
|
2449
2713
|
* // "0-1": [["field1", "value1"]],
|
|
2450
2714
|
* // "0-2": [["field2", "value2"], ["field2", "value3"]],
|
|
2451
|
-
* // }
|
|
2715
|
+
* // }
|
|
2716
|
+
* // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in `mystream`.
|
|
2452
2717
|
* ```
|
|
2453
2718
|
*/
|
|
2454
2719
|
xrange(key: GlideString, start: Boundary<string>, end: Boundary<string>, options?: {
|
|
@@ -2484,7 +2749,8 @@ export declare class BaseClient {
|
|
|
2484
2749
|
* // {
|
|
2485
2750
|
* // "0-2": [["field2", "value2"], ["field2", "value3"]],
|
|
2486
2751
|
* // "0-1": [["field1", "value1"]],
|
|
2487
|
-
* // }
|
|
2752
|
+
* // }
|
|
2753
|
+
* // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in `mystream`.
|
|
2488
2754
|
* ```
|
|
2489
2755
|
*/
|
|
2490
2756
|
xrevrange(key: GlideString, end: Boundary<string>, start: Boundary<string>, options?: {
|
|
@@ -2507,7 +2773,9 @@ export declare class BaseClient {
|
|
|
2507
2773
|
* // Example usage of the zadd method to add elements to a sorted set
|
|
2508
2774
|
* const data = [{ element: "member1", score: 10.5 }, { element: "member2", score: 8.2 }]
|
|
2509
2775
|
* const result = await client.zadd("my_sorted_set", data);
|
|
2510
|
-
* 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`.
|
|
2511
2779
|
* ```
|
|
2512
2780
|
*
|
|
2513
2781
|
* @example
|
|
@@ -2515,7 +2783,9 @@ export declare class BaseClient {
|
|
|
2515
2783
|
* // Example usage of the zadd method to update scores in an existing sorted set
|
|
2516
2784
|
* const options = { conditionalChange: ConditionalChange.ONLY_IF_EXISTS, changed: true };
|
|
2517
2785
|
* const result = await client.zadd("existing_sorted_set", { "member1": 10.5, "member2": 8.2 }, options);
|
|
2518
|
-
* 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`.
|
|
2519
2789
|
* ```
|
|
2520
2790
|
*/
|
|
2521
2791
|
zadd(key: GlideString, membersAndScores: ElementAndScore[] | Record<string, Score>, options?: ZAddOptions): Promise<number>;
|
|
@@ -2537,14 +2807,18 @@ export declare class BaseClient {
|
|
|
2537
2807
|
* ```typescript
|
|
2538
2808
|
* // Example usage of the zaddIncr method to add a member with a score to a sorted set
|
|
2539
2809
|
* const result = await client.zaddIncr("my_sorted_set", member, 5.0);
|
|
2540
|
-
* console.log(result);
|
|
2810
|
+
* console.log(result);
|
|
2811
|
+
* // Output: 5.0
|
|
2812
|
+
* // Score of the member after being updated.
|
|
2541
2813
|
* ```
|
|
2542
2814
|
*
|
|
2543
2815
|
* @example
|
|
2544
2816
|
* ```typescript
|
|
2545
2817
|
* // Example usage of the zaddIncr method to add or update a member with a score in an existing sorted set
|
|
2546
2818
|
* const result = await client.zaddIncr("existing_sorted_set", member, "3.0", { updateOptions: UpdateByScore.LESS_THAN });
|
|
2547
|
-
* console.log(result);
|
|
2819
|
+
* console.log(result);
|
|
2820
|
+
* // Output: null
|
|
2821
|
+
* // Indicates that the member in the sorted set haven't been updated.
|
|
2548
2822
|
* ```
|
|
2549
2823
|
*/
|
|
2550
2824
|
zaddIncr(key: GlideString, member: GlideString, increment: number, options?: ZAddOptions): Promise<number | null>;
|
|
@@ -2563,14 +2837,18 @@ export declare class BaseClient {
|
|
|
2563
2837
|
* ```typescript
|
|
2564
2838
|
* // Example usage of the zrem function to remove members from a sorted set
|
|
2565
2839
|
* const result = await client.zrem("my_sorted_set", ["member1", "member2"]);
|
|
2566
|
-
* 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`.
|
|
2567
2843
|
* ```
|
|
2568
2844
|
*
|
|
2569
2845
|
* @example
|
|
2570
2846
|
* ```typescript
|
|
2571
2847
|
* // Example usage of the zrem function when the sorted set does not exist
|
|
2572
2848
|
* const result = await client.zrem("non_existing_sorted_set", ["member1", "member2"]);
|
|
2573
|
-
* 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.
|
|
2574
2852
|
* ```
|
|
2575
2853
|
*/
|
|
2576
2854
|
zrem(key: GlideString, members: GlideString[]): Promise<number>;
|
|
@@ -2587,14 +2865,17 @@ export declare class BaseClient {
|
|
|
2587
2865
|
* ```typescript
|
|
2588
2866
|
* // Example usage of the zcard method to get the cardinality of a sorted set
|
|
2589
2867
|
* const result = await client.zcard("my_sorted_set");
|
|
2590
|
-
* console.log(result);
|
|
2868
|
+
* console.log(result);
|
|
2869
|
+
* // Output: 3
|
|
2870
|
+
* // Indicates that there are 3 elements in the sorted set `my_sorted_set`.
|
|
2591
2871
|
* ```
|
|
2592
2872
|
*
|
|
2593
2873
|
* @example
|
|
2594
2874
|
* ```typescript
|
|
2595
2875
|
* // Example usage of the zcard method with a non-existing key
|
|
2596
2876
|
* const result = await client.zcard("non_existing_key");
|
|
2597
|
-
* console.log(result);
|
|
2877
|
+
* console.log(result);
|
|
2878
|
+
* // Output: 0
|
|
2598
2879
|
* ```
|
|
2599
2880
|
*/
|
|
2600
2881
|
zcard(key: GlideString): Promise<number>;
|
|
@@ -2613,7 +2894,9 @@ export declare class BaseClient {
|
|
|
2613
2894
|
* @example
|
|
2614
2895
|
* ```typescript
|
|
2615
2896
|
* const cardinality = await client.zintercard(["key1", "key2"], { limit: 10 });
|
|
2616
|
-
* 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.
|
|
2617
2900
|
* ```
|
|
2618
2901
|
*/
|
|
2619
2902
|
zintercard(keys: GlideString[], options?: {
|
|
@@ -2638,7 +2921,9 @@ export declare class BaseClient {
|
|
|
2638
2921
|
* await client.zadd("zset2", {"member2": 2.0});
|
|
2639
2922
|
* await client.zadd("zset3", {"member3": 3.0});
|
|
2640
2923
|
* const result = await client.zdiff(["zset1", "zset2", "zset3"]);
|
|
2641
|
-
* console.log(result);
|
|
2924
|
+
* console.log(result);
|
|
2925
|
+
* // Output: ["member1"]
|
|
2926
|
+
* // `member1` is in `zset1` but not `zset2` or `zset3`.
|
|
2642
2927
|
* ```
|
|
2643
2928
|
*/
|
|
2644
2929
|
zdiff(keys: GlideString[], options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -2661,8 +2946,9 @@ export declare class BaseClient {
|
|
|
2661
2946
|
* await client.zadd("zset2", {"member2": 2.0});
|
|
2662
2947
|
* await client.zadd("zset3", {"member3": 3.0});
|
|
2663
2948
|
* const result = await client.zdiffWithScores(["zset1", "zset2", "zset3"]);
|
|
2664
|
-
* console.log(result);
|
|
2665
|
-
* // [{ 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`
|
|
2666
2952
|
* ```
|
|
2667
2953
|
*/
|
|
2668
2954
|
zdiffWithScores(keys: GlideString[], options?: DecoderOption): Promise<SortedSetDataType>;
|
|
@@ -2684,10 +2970,14 @@ export declare class BaseClient {
|
|
|
2684
2970
|
* await client.zadd("zset1", {"member1": 1.0, "member2": 2.0});
|
|
2685
2971
|
* await client.zadd("zset2", {"member1": 1.0});
|
|
2686
2972
|
* const result1 = await client.zdiffstore("zset3", ["zset1", "zset2"]);
|
|
2687
|
-
* 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`.
|
|
2688
2976
|
*
|
|
2689
2977
|
* const result2 = await client.zrange("zset3", {start: 0, end: -1});
|
|
2690
|
-
* console.log(result2);
|
|
2978
|
+
* console.log(result2);
|
|
2979
|
+
* // Output: ["member2"]
|
|
2980
|
+
* // `member2` is now stored in `my_sorted_set`.
|
|
2691
2981
|
* ```
|
|
2692
2982
|
*/
|
|
2693
2983
|
zdiffstore(destination: GlideString, keys: GlideString[]): Promise<number>;
|
|
@@ -2706,21 +2996,25 @@ export declare class BaseClient {
|
|
|
2706
2996
|
* ```typescript
|
|
2707
2997
|
* // Example usage of the zscore method∂∂ to get the score of a member in a sorted set
|
|
2708
2998
|
* const result = await client.zscore("my_sorted_set", "member");
|
|
2709
|
-
* 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.
|
|
2710
3002
|
* ```
|
|
2711
3003
|
*
|
|
2712
3004
|
* @example
|
|
2713
3005
|
* ```typescript
|
|
2714
3006
|
* // Example usage of the zscore method when the member does not exist in the sorted set
|
|
2715
3007
|
* const result = await client.zscore("my_sorted_set", "non_existing_member");
|
|
2716
|
-
* console.log(result);
|
|
3008
|
+
* console.log(result);
|
|
3009
|
+
* // Output: null
|
|
2717
3010
|
* ```
|
|
2718
3011
|
*
|
|
2719
3012
|
* @example
|
|
2720
3013
|
* ```typescript
|
|
2721
3014
|
* // Example usage of the zscore method with non existimng key
|
|
2722
3015
|
* const result = await client.zscore("non_existing_set", "member");
|
|
2723
|
-
* console.log(result);
|
|
3016
|
+
* console.log(result);
|
|
3017
|
+
* // Output: null
|
|
2724
3018
|
* ```
|
|
2725
3019
|
*/
|
|
2726
3020
|
zscore(key: GlideString, member: GlideString): Promise<number | null>;
|
|
@@ -2748,25 +3042,35 @@ export declare class BaseClient {
|
|
|
2748
3042
|
*
|
|
2749
3043
|
* // use `zunionstore` with default aggregation and weights
|
|
2750
3044
|
* console.log(await client.zunionstore("my_sorted_set", ["key1", "key2"]))
|
|
2751
|
-
* // Output: 2
|
|
3045
|
+
* // Output: 2
|
|
3046
|
+
* // Indicates that the sorted set `my_sorted_set` contains two elements.
|
|
3047
|
+
*
|
|
2752
3048
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
|
|
2753
|
-
* // 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.
|
|
2754
3051
|
* ```
|
|
2755
3052
|
*
|
|
2756
3053
|
* @example
|
|
2757
3054
|
* ```typescript
|
|
2758
3055
|
* // use `zunionstore` with default weights
|
|
2759
3056
|
* console.log(await client.zunionstore("my_sorted_set", ["key1", "key2"], { aggregationType: AggregationType.MAX }))
|
|
2760
|
-
* // 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
|
+
*
|
|
2761
3060
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
|
|
2762
|
-
* // 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.
|
|
2763
3063
|
* ```
|
|
2764
3064
|
*
|
|
2765
3065
|
* @example
|
|
2766
3066
|
* ```typescript
|
|
2767
3067
|
* // use `zunionstore` with default aggregation
|
|
2768
|
-
* console.log(await client.zunionstore("my_sorted_set", [["key1", 2], ["key2", 1]]))
|
|
2769
|
-
*
|
|
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 }
|
|
2770
3074
|
* ```
|
|
2771
3075
|
*/
|
|
2772
3076
|
zunionstore(destination: GlideString, keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -2786,7 +3090,8 @@ export declare class BaseClient {
|
|
|
2786
3090
|
* @example
|
|
2787
3091
|
* ```typescript
|
|
2788
3092
|
* const result = await client.zmscore("zset1", ["member1", "non_existent_member", "member2"]);
|
|
2789
|
-
* 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.
|
|
2790
3095
|
* ```
|
|
2791
3096
|
*/
|
|
2792
3097
|
zmscore(key: GlideString, members: GlideString[]): Promise<(number | null)[]>;
|
|
@@ -2806,14 +3111,18 @@ export declare class BaseClient {
|
|
|
2806
3111
|
* ```typescript
|
|
2807
3112
|
* // Example usage of the zcount method to count members in a sorted set within a score range
|
|
2808
3113
|
* const result = await client.zcount("my_sorted_set", { value: 5.0, isInclusive: true }, InfBoundary.PositiveInfinity);
|
|
2809
|
-
* 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`.
|
|
2810
3117
|
* ```
|
|
2811
3118
|
*
|
|
2812
3119
|
* @example
|
|
2813
3120
|
* ```typescript
|
|
2814
3121
|
* // Example usage of the zcount method to count members in a sorted set within a score range
|
|
2815
3122
|
* const result = await client.zcount("my_sorted_set", { value: 5.0, isInclusive: true }, { value: 10.0, isInclusive: false });
|
|
2816
|
-
* 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`.
|
|
2817
3126
|
* ```
|
|
2818
3127
|
*/
|
|
2819
3128
|
zcount(key: GlideString, minScore: Boundary<number>, maxScore: Boundary<number>): Promise<number>;
|
|
@@ -2840,8 +3149,9 @@ export declare class BaseClient {
|
|
|
2840
3149
|
* ```typescript
|
|
2841
3150
|
* // Example usage of zrange method to retrieve all members of a sorted set in ascending order
|
|
2842
3151
|
* const result = await client.zrange("my_sorted_set", { start: 0, end: -1 });
|
|
2843
|
-
* console.log(result1);
|
|
2844
|
-
* // ['member1', 'member2', 'member3']
|
|
3152
|
+
* console.log(result1);
|
|
3153
|
+
* // Output: ['member1', 'member2', 'member3']
|
|
3154
|
+
* // All members in ascending order
|
|
2845
3155
|
* ```
|
|
2846
3156
|
* @example
|
|
2847
3157
|
* ```typescript
|
|
@@ -2851,8 +3161,9 @@ export declare class BaseClient {
|
|
|
2851
3161
|
* end: InfBoundary.NegativeInfinity,
|
|
2852
3162
|
* type: "byScore",
|
|
2853
3163
|
* }, { reverse: true });
|
|
2854
|
-
* console.log(result);
|
|
2855
|
-
* // ['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
|
|
2856
3167
|
* ```
|
|
2857
3168
|
*/
|
|
2858
3169
|
zrange(key: GlideString, rangeQuery: RangeByScore | RangeByLex | RangeByIndex, options?: {
|
|
@@ -2882,8 +3193,9 @@ export declare class BaseClient {
|
|
|
2882
3193
|
* end: { value: 20, isInclusive: false },
|
|
2883
3194
|
* type: "byScore",
|
|
2884
3195
|
* });
|
|
2885
|
-
* console.log(result);
|
|
2886
|
-
* // [{ 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
|
|
2887
3199
|
* ```
|
|
2888
3200
|
* @example
|
|
2889
3201
|
* ```typescript
|
|
@@ -2893,8 +3205,9 @@ export declare class BaseClient {
|
|
|
2893
3205
|
* end: InfBoundary.NegativeInfinity,
|
|
2894
3206
|
* type: "byScore",
|
|
2895
3207
|
* }, { reverse: true });
|
|
2896
|
-
* console.log(result);
|
|
2897
|
-
* // [{ 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
|
|
2898
3211
|
* ```
|
|
2899
3212
|
*/
|
|
2900
3213
|
zrangeWithScores(key: GlideString, rangeQuery: RangeByScore | RangeByIndex, options?: {
|
|
@@ -2922,17 +3235,21 @@ export declare class BaseClient {
|
|
|
2922
3235
|
* ```typescript
|
|
2923
3236
|
* // Example usage of zrangeStore to retrieve and store all members of a sorted set in ascending order.
|
|
2924
3237
|
* const result = await client.zrangeStore("destination_key", "my_sorted_set", { start: 0, end: -1 });
|
|
2925
|
-
* 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`.
|
|
2926
3241
|
* ```
|
|
2927
3242
|
* @example
|
|
2928
3243
|
* ```typescript
|
|
2929
|
-
* // 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`
|
|
2930
3245
|
* const result = await client.zrangeStore("destination_key", "my_sorted_set", {
|
|
2931
3246
|
* start: InfBoundary.NegativeInfinity,
|
|
2932
3247
|
* end: { value: 3, isInclusive: false },
|
|
2933
3248
|
* type: "byScore",
|
|
2934
3249
|
* });
|
|
2935
|
-
* 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`.
|
|
2936
3253
|
* ```
|
|
2937
3254
|
*/
|
|
2938
3255
|
zrangeStore(destination: GlideString, source: GlideString, rangeQuery: RangeByScore | RangeByLex | RangeByIndex, reverse?: boolean): Promise<number>;
|
|
@@ -2960,15 +3277,21 @@ export declare class BaseClient {
|
|
|
2960
3277
|
*
|
|
2961
3278
|
* // use `zinterstore` with default aggregation and weights
|
|
2962
3279
|
* console.log(await client.zinterstore("my_sorted_set", ["key1", "key2"]))
|
|
2963
|
-
* // Output: 1
|
|
3280
|
+
* // Output: 1
|
|
3281
|
+
* // Indicates that the sorted set `my_sorted_set` contains one element.
|
|
3282
|
+
*
|
|
2964
3283
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, end: -1}))
|
|
2965
|
-
* // Output: {'member1': 20}
|
|
3284
|
+
* // Output: {'member1': 20}
|
|
3285
|
+
* // `member1` is now stored in `my_sorted_set` with score of 20.
|
|
2966
3286
|
*
|
|
2967
3287
|
* // use `zinterstore` with default weights
|
|
2968
3288
|
* console.log(await client.zinterstore("my_sorted_set", ["key1", "key2"] , { aggregationType: AggregationType.MAX }))
|
|
2969
|
-
* // 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
|
+
*
|
|
2970
3292
|
* console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, end: -1}))
|
|
2971
|
-
* // Output: {'member1': 10.5}
|
|
3293
|
+
* // Output: {'member1': 10.5}
|
|
3294
|
+
* // `member1` is now stored in `my_sorted_set` with score of 10.5.
|
|
2972
3295
|
* ```
|
|
2973
3296
|
*/
|
|
2974
3297
|
zinterstore(destination: GlideString, keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -2994,7 +3317,9 @@ export declare class BaseClient {
|
|
|
2994
3317
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
2995
3318
|
* await client.zadd("key2", {"member1": 9.5});
|
|
2996
3319
|
* const result = await client.zinter(["key1", "key2"]);
|
|
2997
|
-
* console.log(result);
|
|
3320
|
+
* console.log(result);
|
|
3321
|
+
* // Output: ['member1']
|
|
3322
|
+
* // The intersecting element for the sorted sets at `key1` and `key2`.
|
|
2998
3323
|
* ```
|
|
2999
3324
|
*/
|
|
3000
3325
|
zinter(keys: GlideString[], options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -3024,11 +3349,14 @@ export declare class BaseClient {
|
|
|
3024
3349
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
3025
3350
|
* await client.zadd("key2", {"member1": 9.5});
|
|
3026
3351
|
* const result1 = await client.zinterWithScores(["key1", "key2"]);
|
|
3027
|
-
* console.log(result1);
|
|
3028
|
-
* // [{ element: 'member1', score: 20 }]
|
|
3352
|
+
* console.log(result1);
|
|
3353
|
+
* // Output: [{ element: 'member1', score: 20 }]
|
|
3354
|
+
* // `member1` with score of 20 is the result
|
|
3355
|
+
*
|
|
3029
3356
|
* const result2 = await client.zinterWithScores(["key1", "key2"], AggregationType.MAX)
|
|
3030
|
-
* console.log(result2);
|
|
3031
|
-
* // [{ 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
|
|
3032
3360
|
* ```
|
|
3033
3361
|
*/
|
|
3034
3362
|
zinterWithScores(keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -3053,7 +3381,9 @@ export declare class BaseClient {
|
|
|
3053
3381
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
3054
3382
|
* await client.zadd("key2", {"member1": 9.5});
|
|
3055
3383
|
* const result = await client.zunion(["key1", "key2"]);
|
|
3056
|
-
* console.log(result);
|
|
3384
|
+
* console.log(result);
|
|
3385
|
+
* // Output: ['member1', 'member2']
|
|
3386
|
+
* // Union elements from sets stored at keys `key1` and `key2`.
|
|
3057
3387
|
* ```
|
|
3058
3388
|
*/
|
|
3059
3389
|
zunion(keys: GlideString[], options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -3081,11 +3411,14 @@ export declare class BaseClient {
|
|
|
3081
3411
|
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
|
|
3082
3412
|
* await client.zadd("key2", {"member1": 9.5});
|
|
3083
3413
|
* const result1 = await client.zunionWithScores(["key1", "key2"]);
|
|
3084
|
-
* console.log(result1);
|
|
3085
|
-
* // [{ 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
|
+
*
|
|
3086
3418
|
* const result2 = await client.zunionWithScores(["key1", "key2"], "MAX");
|
|
3087
|
-
* console.log(result2);
|
|
3088
|
-
* // [{ 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.
|
|
3089
3422
|
* ```
|
|
3090
3423
|
*/
|
|
3091
3424
|
zunionWithScores(keys: GlideString[] | KeyWeight[], options?: {
|
|
@@ -3104,13 +3437,17 @@ export declare class BaseClient {
|
|
|
3104
3437
|
* @example
|
|
3105
3438
|
* ```typescript
|
|
3106
3439
|
* const payload1 = await client.zrandmember("mySortedSet");
|
|
3107
|
-
* console.log(payload1);
|
|
3440
|
+
* console.log(payload1);
|
|
3441
|
+
* // Output: "Glide"
|
|
3442
|
+
* // A random member from the set
|
|
3108
3443
|
* ```
|
|
3109
3444
|
*
|
|
3110
3445
|
* @example
|
|
3111
3446
|
* ```typescript
|
|
3112
3447
|
* const payload2 = await client.zrandmember("nonExistingSortedSet");
|
|
3113
|
-
* console.log(payload2);
|
|
3448
|
+
* console.log(payload2);
|
|
3449
|
+
* // Output: null
|
|
3450
|
+
* // Since the sorted set does not exist.
|
|
3114
3451
|
* ```
|
|
3115
3452
|
*/
|
|
3116
3453
|
zrandmember(key: GlideString, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -3130,13 +3467,17 @@ export declare class BaseClient {
|
|
|
3130
3467
|
* @example
|
|
3131
3468
|
* ```typescript
|
|
3132
3469
|
* const payload1 = await client.zrandmemberWithCount("mySortedSet", -3);
|
|
3133
|
-
* console.log(payload1);
|
|
3470
|
+
* console.log(payload1);
|
|
3471
|
+
* // Output: ["Glide", "GLIDE", "node"]
|
|
3472
|
+
* // Returns 3 random members from the sorted set, with duplicates allowed.
|
|
3134
3473
|
* ```
|
|
3135
3474
|
*
|
|
3136
3475
|
* @example
|
|
3137
3476
|
* ```typescript
|
|
3138
3477
|
* const payload2 = await client.zrandmemberWithCount("nonExistingKey", 3);
|
|
3139
|
-
* console.log(payload1);
|
|
3478
|
+
* console.log(payload1);
|
|
3479
|
+
* // Output: []
|
|
3480
|
+
* // Since the sorted set does not exist.
|
|
3140
3481
|
* ```
|
|
3141
3482
|
*/
|
|
3142
3483
|
zrandmemberWithCount(key: GlideString, count: number, options?: DecoderOption): Promise<GlideString[]>;
|
|
@@ -3156,13 +3497,17 @@ export declare class BaseClient {
|
|
|
3156
3497
|
* @example
|
|
3157
3498
|
* ```typescript
|
|
3158
3499
|
* const payload1 = await client.zrandmemberWithCountWithScore("mySortedSet", -3);
|
|
3159
|
-
* 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.
|
|
3160
3503
|
* ```
|
|
3161
3504
|
*
|
|
3162
3505
|
* @example
|
|
3163
3506
|
* ```typescript
|
|
3164
3507
|
* const payload2 = await client.zrandmemberWithCountWithScore("nonExistingKey", 3);
|
|
3165
|
-
* console.log(payload1);
|
|
3508
|
+
* console.log(payload1);
|
|
3509
|
+
* // Output: []
|
|
3510
|
+
* // Since the sorted set does not exist.
|
|
3166
3511
|
* ```
|
|
3167
3512
|
*/
|
|
3168
3513
|
zrandmemberWithCountWithScores(key: GlideString, count: number, options?: DecoderOption): Promise<KeyWeight[]>;
|
|
@@ -3179,15 +3524,17 @@ export declare class BaseClient {
|
|
|
3179
3524
|
* ```typescript
|
|
3180
3525
|
* // Example usage of strlen method with an existing key
|
|
3181
3526
|
* await client.set("key", "GLIDE");
|
|
3182
|
-
* const
|
|
3183
|
-
* console.log(
|
|
3527
|
+
* const length1 = await client.strlen("key");
|
|
3528
|
+
* console.log(length1);
|
|
3529
|
+
* // Output: 5
|
|
3184
3530
|
* ```
|
|
3185
3531
|
*
|
|
3186
3532
|
* @example
|
|
3187
3533
|
* ```typescript
|
|
3188
3534
|
* // Example usage of strlen method with a non-existing key
|
|
3189
|
-
* const
|
|
3190
|
-
* console.log(
|
|
3535
|
+
* const length2 = await client.strlen("non_existing_key");
|
|
3536
|
+
* console.log(length2);
|
|
3537
|
+
* // Output: 0
|
|
3191
3538
|
* ```
|
|
3192
3539
|
*/
|
|
3193
3540
|
strlen(key: GlideString): Promise<number>;
|
|
@@ -3204,7 +3551,8 @@ export declare class BaseClient {
|
|
|
3204
3551
|
* // Example usage of type method with a string value
|
|
3205
3552
|
* await client.set("key", "value");
|
|
3206
3553
|
* const type = await client.type("key");
|
|
3207
|
-
* console.log(type);
|
|
3554
|
+
* console.log(type);
|
|
3555
|
+
* // Output: 'string'
|
|
3208
3556
|
* ```
|
|
3209
3557
|
*
|
|
3210
3558
|
* @example
|
|
@@ -3212,7 +3560,8 @@ export declare class BaseClient {
|
|
|
3212
3560
|
* // Example usage of type method with a list
|
|
3213
3561
|
* await client.lpush("key", ["value"]);
|
|
3214
3562
|
* const type = await client.type("key");
|
|
3215
|
-
* console.log(type);
|
|
3563
|
+
* console.log(type);
|
|
3564
|
+
* // Output: 'list'
|
|
3216
3565
|
* ```
|
|
3217
3566
|
*/
|
|
3218
3567
|
type(key: GlideString): Promise<string>;
|
|
@@ -3235,21 +3584,22 @@ export declare class BaseClient {
|
|
|
3235
3584
|
* ```typescript
|
|
3236
3585
|
* // Example usage of zpopmin method to remove and return the member with the lowest score from a sorted set
|
|
3237
3586
|
* const result = await client.zpopmin("my_sorted_set");
|
|
3238
|
-
* console.log(result);
|
|
3239
|
-
* // 'member1'
|
|
3240
|
-
* //
|
|
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
|
|
3241
3590
|
* ```
|
|
3242
3591
|
*
|
|
3243
3592
|
* @example
|
|
3244
3593
|
* ```typescript
|
|
3245
3594
|
* // Example usage of zpopmin method to remove and return multiple members with the lowest scores from a sorted set
|
|
3246
3595
|
* const result = await client.zpopmin("my_sorted_set", 2);
|
|
3247
|
-
* console.log(result);
|
|
3248
|
-
* //
|
|
3596
|
+
* console.log(result);
|
|
3597
|
+
* // Output:
|
|
3249
3598
|
* // [
|
|
3250
3599
|
* // { element: 'member3', score: 7.5 },
|
|
3251
3600
|
* // { element: 'member2', score: 8.0 }
|
|
3252
3601
|
* // ]
|
|
3602
|
+
* // `member3` with a score of 7.5 and `member2` with a score of 8.0 have been removed from the sorted set
|
|
3253
3603
|
* ```
|
|
3254
3604
|
*/
|
|
3255
3605
|
zpopmin(key: GlideString, options?: {
|
|
@@ -3274,7 +3624,9 @@ export declare class BaseClient {
|
|
|
3274
3624
|
* @example
|
|
3275
3625
|
* ```typescript
|
|
3276
3626
|
* const data = await client.bzpopmin(["zset1", "zset2"], 0.5);
|
|
3277
|
-
* console.log(data);
|
|
3627
|
+
* console.log(data);
|
|
3628
|
+
* // Output: ["zset1", "a", 2];
|
|
3629
|
+
* // Pops the member `a` with score 2 stored at key `zset1`.
|
|
3278
3630
|
* ```
|
|
3279
3631
|
*/
|
|
3280
3632
|
bzpopmin(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString, number] | null>;
|
|
@@ -3297,21 +3649,22 @@ export declare class BaseClient {
|
|
|
3297
3649
|
* ```typescript
|
|
3298
3650
|
* // Example usage of zpopmax method to remove and return the member with the highest score from a sorted set
|
|
3299
3651
|
* const result = await client.zpopmax("my_sorted_set");
|
|
3300
|
-
* console.log(result);
|
|
3301
|
-
* // 'member1'
|
|
3302
|
-
* //
|
|
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
|
|
3303
3655
|
* ```
|
|
3304
3656
|
*
|
|
3305
3657
|
* @example
|
|
3306
3658
|
* ```typescript
|
|
3307
3659
|
* // Example usage of zpopmax method to remove and return multiple members with the highest scores from a sorted set
|
|
3308
3660
|
* const result = await client.zpopmax("my_sorted_set", 2);
|
|
3309
|
-
* console.log(result);
|
|
3310
|
-
* //
|
|
3661
|
+
* console.log(result);
|
|
3662
|
+
* // Output:
|
|
3311
3663
|
* // [
|
|
3312
3664
|
* // { element: 'member3', score: 7.5 },
|
|
3313
3665
|
* // { element: 'member2', score: 8.0 }
|
|
3314
3666
|
* // ]
|
|
3667
|
+
* // `member3` with a score of 7.5 and `member2` with a score of 8.0 have been removed from the sorted set
|
|
3315
3668
|
* ```
|
|
3316
3669
|
*/
|
|
3317
3670
|
zpopmax(key: GlideString, options?: {
|
|
@@ -3336,7 +3689,8 @@ export declare class BaseClient {
|
|
|
3336
3689
|
* @example
|
|
3337
3690
|
* ```typescript
|
|
3338
3691
|
* const data = await client.bzpopmax(["zset1", "zset2"], 0.5);
|
|
3339
|
-
* console.log(data);
|
|
3692
|
+
* console.log(data);
|
|
3693
|
+
* // Output: ["zset1", "c", 2];
|
|
3340
3694
|
* ```
|
|
3341
3695
|
*/
|
|
3342
3696
|
bzpopmax(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString, number] | null>;
|
|
@@ -3352,21 +3706,27 @@ export declare class BaseClient {
|
|
|
3352
3706
|
* ```typescript
|
|
3353
3707
|
* // Example usage of pttl method with an existing key
|
|
3354
3708
|
* const result = await client.pttl("my_key");
|
|
3355
|
-
* 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.
|
|
3356
3712
|
* ```
|
|
3357
3713
|
*
|
|
3358
3714
|
* @example
|
|
3359
3715
|
* ```typescript
|
|
3360
3716
|
* // Example usage of pttl method with a non-existing key
|
|
3361
3717
|
* const result = await client.pttl("non_existing_key");
|
|
3362
|
-
* console.log(result);
|
|
3718
|
+
* console.log(result);
|
|
3719
|
+
* // Output: -2
|
|
3720
|
+
* // Indicates that the key `non_existing_key` does not exist.
|
|
3363
3721
|
* ```
|
|
3364
3722
|
*
|
|
3365
3723
|
* @example
|
|
3366
3724
|
* ```typescript
|
|
3367
3725
|
* // Example usage of pttl method with an exisiting key that has no associated expire.
|
|
3368
3726
|
* const result = await client.pttl("key");
|
|
3369
|
-
* console.log(result);
|
|
3727
|
+
* console.log(result);
|
|
3728
|
+
* // Output: -1
|
|
3729
|
+
* // Indicates that the key `key` has no associated expire.
|
|
3370
3730
|
* ```
|
|
3371
3731
|
*/
|
|
3372
3732
|
pttl(key: GlideString): Promise<number>;
|
|
@@ -3389,7 +3749,9 @@ export declare class BaseClient {
|
|
|
3389
3749
|
* ```typescript
|
|
3390
3750
|
* // Example usage of zremRangeByRank method
|
|
3391
3751
|
* const result = await client.zremRangeByRank("my_sorted_set", 0, 2);
|
|
3392
|
-
* 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.
|
|
3393
3755
|
* ```
|
|
3394
3756
|
*/
|
|
3395
3757
|
zremRangeByRank(key: GlideString, start: number, end: number): Promise<number>;
|
|
@@ -3409,14 +3771,18 @@ export declare class BaseClient {
|
|
|
3409
3771
|
* ```typescript
|
|
3410
3772
|
* // Example usage of zremRangeByLex method to remove members from a sorted set based on lexicographical order range
|
|
3411
3773
|
* const result = await client.zremRangeByLex("my_sorted_set", { value: "a", isInclusive: false }, { value: "e" });
|
|
3412
|
-
* 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`.
|
|
3413
3777
|
* ```
|
|
3414
3778
|
*
|
|
3415
3779
|
* @example
|
|
3416
3780
|
* ```typescript
|
|
3417
3781
|
* // Example usage of zremRangeByLex method when the sorted set does not exist
|
|
3418
3782
|
* const result = await client.zremRangeByLex("non_existing_sorted_set", InfBoundary.NegativeInfinity, { value: "e" });
|
|
3419
|
-
* console.log(result);
|
|
3783
|
+
* console.log(result);
|
|
3784
|
+
* // Output: 0
|
|
3785
|
+
* // Indicates that no elements were removed.
|
|
3420
3786
|
* ```
|
|
3421
3787
|
*/
|
|
3422
3788
|
zremRangeByLex(key: GlideString, minLex: Boundary<GlideString>, maxLex: Boundary<GlideString>): Promise<number>;
|
|
@@ -3436,14 +3802,18 @@ export declare class BaseClient {
|
|
|
3436
3802
|
* ```typescript
|
|
3437
3803
|
* // Example usage of zremRangeByScore method to remove members from a sorted set based on score range
|
|
3438
3804
|
* const result = await client.zremRangeByScore("my_sorted_set", { value: 5.0, isInclusive: true }, InfBoundary.PositiveInfinity);
|
|
3439
|
-
* 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`.
|
|
3440
3808
|
* ```
|
|
3441
3809
|
*
|
|
3442
3810
|
* @example
|
|
3443
3811
|
* ```typescript
|
|
3444
3812
|
* // Example usage of zremRangeByScore method when the sorted set does not exist
|
|
3445
3813
|
* const result = await client.zremRangeByScore("non_existing_sorted_set", { value: 5.0, isInclusive: true }, { value: 10.0, isInclusive: false });
|
|
3446
|
-
* 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.
|
|
3447
3817
|
* ```
|
|
3448
3818
|
*/
|
|
3449
3819
|
zremRangeByScore(key: GlideString, minScore: Boundary<number>, maxScore: Boundary<number>): Promise<number>;
|
|
@@ -3462,13 +3832,17 @@ export declare class BaseClient {
|
|
|
3462
3832
|
* @example
|
|
3463
3833
|
* ```typescript
|
|
3464
3834
|
* const result = await client.zlexcount("my_sorted_set", {value: "c"}, InfBoundary.PositiveInfinity);
|
|
3465
|
-
* 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`.
|
|
3466
3838
|
* ```
|
|
3467
3839
|
*
|
|
3468
3840
|
* @example
|
|
3469
3841
|
* ```typescript
|
|
3470
3842
|
* const result = await client.zlexcount("my_sorted_set", {value: "c"}, {value: "k", isInclusive: false});
|
|
3471
|
-
* 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`.
|
|
3472
3846
|
* ```
|
|
3473
3847
|
*/
|
|
3474
3848
|
zlexcount(key: GlideString, minLex: Boundary<GlideString>, maxLex: Boundary<GlideString>): Promise<number>;
|
|
@@ -3487,14 +3861,18 @@ export declare class BaseClient {
|
|
|
3487
3861
|
* ```typescript
|
|
3488
3862
|
* // Example usage of zrank method to retrieve the rank of a member in a sorted set
|
|
3489
3863
|
* const result = await client.zrank("my_sorted_set", "member2");
|
|
3490
|
-
* 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`.
|
|
3491
3867
|
* ```
|
|
3492
3868
|
*
|
|
3493
3869
|
* @example
|
|
3494
3870
|
* ```typescript
|
|
3495
3871
|
* // Example usage of zrank method with a non-existing member
|
|
3496
3872
|
* const result = await client.zrank("my_sorted_set", "non_existing_member");
|
|
3497
|
-
* 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`.
|
|
3498
3876
|
* ```
|
|
3499
3877
|
*/
|
|
3500
3878
|
zrank(key: GlideString, member: GlideString): Promise<number | null>;
|
|
@@ -3513,14 +3891,18 @@ export declare class BaseClient {
|
|
|
3513
3891
|
* ```typescript
|
|
3514
3892
|
* // Example usage of zrank_withscore method to retrieve the rank and score of a member in a sorted set
|
|
3515
3893
|
* const result = await client.zrank_withscore("my_sorted_set", "member2");
|
|
3516
|
-
* 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`.
|
|
3517
3897
|
* ```
|
|
3518
3898
|
*
|
|
3519
3899
|
* @example
|
|
3520
3900
|
* ```typescript
|
|
3521
3901
|
* // Example usage of zrank_withscore method with a non-existing member
|
|
3522
3902
|
* const result = await client.zrank_withscore("my_sorted_set", "non_existing_member");
|
|
3523
|
-
* 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`.
|
|
3524
3906
|
* ```
|
|
3525
3907
|
*/
|
|
3526
3908
|
zrankWithScore(key: GlideString, member: GlideString): Promise<[number, number] | null>;
|
|
@@ -3539,7 +3921,9 @@ export declare class BaseClient {
|
|
|
3539
3921
|
* @example
|
|
3540
3922
|
* ```typescript
|
|
3541
3923
|
* const result = await client.zrevrank("my_sorted_set", "member2");
|
|
3542
|
-
* 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`.
|
|
3543
3927
|
* ```
|
|
3544
3928
|
*/
|
|
3545
3929
|
zrevrank(key: GlideString, member: GlideString): Promise<number | null>;
|
|
@@ -3559,7 +3943,9 @@ export declare class BaseClient {
|
|
|
3559
3943
|
* @example
|
|
3560
3944
|
* ```typescript
|
|
3561
3945
|
* const result = await client.zrevankWithScore("my_sorted_set", "member2");
|
|
3562
|
-
* 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`.
|
|
3563
3949
|
* ```
|
|
3564
3950
|
*/
|
|
3565
3951
|
zrevrankWithScore(key: GlideString, member: GlideString): Promise<[number, number] | null>;
|
|
@@ -3588,7 +3974,8 @@ export declare class BaseClient {
|
|
|
3588
3974
|
* @example
|
|
3589
3975
|
* ```typescript
|
|
3590
3976
|
* console.log(await client.xdel("key", ["1538561698944-0", "1538561698944-1"]));
|
|
3591
|
-
* // Output
|
|
3977
|
+
* // Output: 2
|
|
3978
|
+
* // the stream marked 2 entries as deleted.
|
|
3592
3979
|
* ```
|
|
3593
3980
|
*/
|
|
3594
3981
|
xdel(key: GlideString, ids: string[]): Promise<number>;
|
|
@@ -3614,12 +4001,13 @@ export declare class BaseClient {
|
|
|
3614
4001
|
* @example
|
|
3615
4002
|
* ```typescript
|
|
3616
4003
|
* const streamResults = await client.xread({"my_stream": "0-0", "writers": "0-0"});
|
|
3617
|
-
* console.log(result);
|
|
4004
|
+
* console.log(result);
|
|
4005
|
+
* // Output:
|
|
3618
4006
|
* // [
|
|
3619
4007
|
* // {
|
|
3620
|
-
* // key: "my_stream",
|
|
3621
|
-
* // value: {
|
|
3622
|
-
* // "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.
|
|
3623
4011
|
* // "1526999352406-0": [["duration", "812"], ["event-id", "9"], ["user-id", "388234"]],
|
|
3624
4012
|
* // }
|
|
3625
4013
|
* // },
|
|
@@ -3650,7 +4038,8 @@ export declare class BaseClient {
|
|
|
3650
4038
|
* @example
|
|
3651
4039
|
* ```typescript
|
|
3652
4040
|
* const streamResults = await client.xreadgroup("my_group", "my_consumer", {"my_stream": "0-0", "writers_stream": "0-0", "readers_stream", ">"});
|
|
3653
|
-
* console.log(result);
|
|
4041
|
+
* console.log(result);
|
|
4042
|
+
* // Output:
|
|
3654
4043
|
* // [
|
|
3655
4044
|
* // {
|
|
3656
4045
|
* // key: "my_stream",
|
|
@@ -3685,7 +4074,9 @@ export declare class BaseClient {
|
|
|
3685
4074
|
* @example
|
|
3686
4075
|
* ```typescript
|
|
3687
4076
|
* const numEntries = await client.xlen("my_stream");
|
|
3688
|
-
* console.log(numEntries);
|
|
4077
|
+
* console.log(numEntries);
|
|
4078
|
+
* // Output: 2
|
|
4079
|
+
* // `my_stream` contains 2 entries.
|
|
3689
4080
|
* ```
|
|
3690
4081
|
*/
|
|
3691
4082
|
xlen(key: GlideString): Promise<number>;
|
|
@@ -3699,7 +4090,8 @@ export declare class BaseClient {
|
|
|
3699
4090
|
* @returns An `array` that includes the summary of the pending messages. See example for more details.
|
|
3700
4091
|
* @example
|
|
3701
4092
|
* ```typescript
|
|
3702
|
-
* console.log(await client.xpending("my_stream", "my_group"));
|
|
4093
|
+
* console.log(await client.xpending("my_stream", "my_group"));
|
|
4094
|
+
* // Output:
|
|
3703
4095
|
* // [
|
|
3704
4096
|
* // 42, // The total number of pending messages
|
|
3705
4097
|
* // "1722643465939-0", // The smallest ID among the pending messages
|
|
@@ -3729,7 +4121,8 @@ export declare class BaseClient {
|
|
|
3729
4121
|
* end: InfBoundary.PositiveInfinity,
|
|
3730
4122
|
* count: 2,
|
|
3731
4123
|
* consumer: "consumer1"
|
|
3732
|
-
* });
|
|
4124
|
+
* });
|
|
4125
|
+
* // Output:
|
|
3733
4126
|
* // [
|
|
3734
4127
|
* // [
|
|
3735
4128
|
* // "1722643465939-0", // The ID of the message
|
|
@@ -3762,13 +4155,14 @@ export declare class BaseClient {
|
|
|
3762
4155
|
* @example
|
|
3763
4156
|
* ```typescript
|
|
3764
4157
|
* const result = await client.xinfoConsumers("my_stream", "my_group");
|
|
3765
|
-
* console.log(result);
|
|
4158
|
+
* console.log(result);
|
|
4159
|
+
* // Output:
|
|
3766
4160
|
* // [
|
|
3767
4161
|
* // {
|
|
3768
|
-
* // "name": "Alice",
|
|
3769
|
-
* // "pending": 1,
|
|
3770
|
-
* // "idle": 9104628,
|
|
3771
|
-
* // "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.
|
|
3772
4166
|
* // },
|
|
3773
4167
|
* // ...
|
|
3774
4168
|
* // ]
|
|
@@ -3787,23 +4181,24 @@ export declare class BaseClient {
|
|
|
3787
4181
|
* @example
|
|
3788
4182
|
* ```typescript
|
|
3789
4183
|
* const result = await client.xinfoGroups("my_stream");
|
|
3790
|
-
* console.log(result);
|
|
4184
|
+
* console.log(result);
|
|
4185
|
+
* // Output:
|
|
3791
4186
|
* // [
|
|
3792
4187
|
* // {
|
|
3793
|
-
* // "name": "mygroup",
|
|
3794
|
-
* // "consumers": 2,
|
|
3795
|
-
* // "pending": 2,
|
|
3796
|
-
* // "last-delivered-id": "1638126030001-0",
|
|
3797
|
-
* // "entries-read": 2,
|
|
3798
|
-
* // "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.
|
|
3799
4194
|
* // },
|
|
3800
4195
|
* // {
|
|
3801
4196
|
* // "name": "some-other-group",
|
|
3802
4197
|
* // "consumers": 1,
|
|
3803
4198
|
* // "pending": 0,
|
|
3804
4199
|
* // "last-delivered-id": "0-0",
|
|
3805
|
-
* // "entries-read": null, // Added in
|
|
3806
|
-
* // "lag": 1 // Added in
|
|
4200
|
+
* // "entries-read": null, // Added in Valkey 7.0.0.
|
|
4201
|
+
* // "lag": 1 // Added in Valkey 7.0.0.
|
|
3807
4202
|
* // }
|
|
3808
4203
|
* // ]
|
|
3809
4204
|
* ```
|
|
@@ -3826,9 +4221,14 @@ export declare class BaseClient {
|
|
|
3826
4221
|
* ```typescript
|
|
3827
4222
|
* const result = await client.xclaim("myStream", "myGroup", "myConsumer", 42,
|
|
3828
4223
|
* ["1-0", "2-0", "3-0"], { idle: 500, retryCount: 3, isForce: true });
|
|
3829
|
-
* console.log(result);
|
|
4224
|
+
* console.log(result);
|
|
4225
|
+
* // Output:
|
|
3830
4226
|
* // {
|
|
3831
|
-
* // "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
|
+
* // ]
|
|
3832
4232
|
* // }
|
|
3833
4233
|
* ```
|
|
3834
4234
|
*/
|
|
@@ -3860,7 +4260,8 @@ export declare class BaseClient {
|
|
|
3860
4260
|
* @example
|
|
3861
4261
|
* ```typescript
|
|
3862
4262
|
* const result = await client.xautoclaim("myStream", "myGroup", "myConsumer", 42, "0-0", { count: 25 });
|
|
3863
|
-
* console.log(result);
|
|
4263
|
+
* console.log(result);
|
|
4264
|
+
* // Output:
|
|
3864
4265
|
* // [
|
|
3865
4266
|
* // "1609338788321-0", // value to be used as `start` argument
|
|
3866
4267
|
* // // for the next `xautoclaim` call
|
|
@@ -3906,7 +4307,8 @@ export declare class BaseClient {
|
|
|
3906
4307
|
* @example
|
|
3907
4308
|
* ```typescript
|
|
3908
4309
|
* const result = await client.xautoclaim("myStream", "myGroup", "myConsumer", 42, "0-0", { count: 25 });
|
|
3909
|
-
* console.log(result);
|
|
4310
|
+
* console.log(result);
|
|
4311
|
+
* // Output:
|
|
3910
4312
|
* // [
|
|
3911
4313
|
* // "1609338788321-0", // value to be used as `start` argument
|
|
3912
4314
|
* // // for the next `xautoclaim` call
|
|
@@ -3942,7 +4344,9 @@ export declare class BaseClient {
|
|
|
3942
4344
|
* ```typescript
|
|
3943
4345
|
* const result = await client.xclaimJustId("my_stream", "my_group", "my_consumer", 42,
|
|
3944
4346
|
* ["1-0", "2-0", "3-0"], { idle: 500, retryCount: 3, isForce: true });
|
|
3945
|
-
* console.log(result);
|
|
4347
|
+
* console.log(result);
|
|
4348
|
+
* // Output: [ "2-0", "3-0" ]
|
|
4349
|
+
* // A list of entry ids.
|
|
3946
4350
|
* ```
|
|
3947
4351
|
*/
|
|
3948
4352
|
xclaimJustId(key: GlideString, group: GlideString, consumer: GlideString, minIdleTime: number, ids: string[], options?: StreamClaimOptions): Promise<string[]>;
|
|
@@ -3960,7 +4364,8 @@ export declare class BaseClient {
|
|
|
3960
4364
|
* @example
|
|
3961
4365
|
* ```typescript
|
|
3962
4366
|
* // Create the consumer group "mygroup", using zero as the starting ID:
|
|
3963
|
-
* console.log(await client.xgroupCreate("mystream", "mygroup", "0-0"));
|
|
4367
|
+
* console.log(await client.xgroupCreate("mystream", "mygroup", "0-0"));
|
|
4368
|
+
* // Output: "OK"
|
|
3964
4369
|
* ```
|
|
3965
4370
|
*/
|
|
3966
4371
|
xgroupCreate(key: GlideString, groupName: GlideString, id: string, options?: StreamGroupOptions): Promise<"OK">;
|
|
@@ -3976,7 +4381,8 @@ export declare class BaseClient {
|
|
|
3976
4381
|
* @example
|
|
3977
4382
|
* ```typescript
|
|
3978
4383
|
* // Destroys the consumer group "mygroup"
|
|
3979
|
-
* console.log(await client.xgroupDestroy("mystream", "mygroup"));
|
|
4384
|
+
* console.log(await client.xgroupDestroy("mystream", "mygroup"));
|
|
4385
|
+
* // Output: true
|
|
3980
4386
|
* ```
|
|
3981
4387
|
*/
|
|
3982
4388
|
xgroupDestroy(key: GlideString, groupName: GlideString): Promise<boolean>;
|
|
@@ -3990,6 +4396,7 @@ export declare class BaseClient {
|
|
|
3990
4396
|
* - (Optional) `fullOptions`: If `true`, returns verbose information with a limit of the first 10 PEL entries.
|
|
3991
4397
|
* If `number` is specified, returns verbose information limiting the returned PEL entries.
|
|
3992
4398
|
* If `0` is specified, returns verbose information with no limit.
|
|
4399
|
+
* @remark `fullOptions` - Available since Valkey version 6.0.0
|
|
3993
4400
|
* - (Optional) `decoder`: see {@link DecoderOption}.
|
|
3994
4401
|
* @returns A {@link ReturnTypeXinfoStream} of detailed stream information for the given `key`. See
|
|
3995
4402
|
* the example for a sample response.
|
|
@@ -3999,46 +4406,46 @@ export declare class BaseClient {
|
|
|
3999
4406
|
* const infoResult = await client.xinfoStream("my_stream");
|
|
4000
4407
|
* console.log(infoResult);
|
|
4001
4408
|
* // Output: {
|
|
4002
|
-
* // length: 2,
|
|
4003
|
-
* // "radix-tree-keys": 1,
|
|
4004
|
-
* // "radix-tree-nodes": 2,
|
|
4005
|
-
* // "last-generated-id": "1719877599564-1",
|
|
4006
|
-
* // "max-deleted-entry-id": "0-0",
|
|
4007
|
-
* // "entries-added": 2,
|
|
4008
|
-
* // "recorded-first-entry-id": "1719877599564-0",
|
|
4009
|
-
* // "first-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
|
|
4010
|
-
* // "last-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
|
|
4011
|
-
* // 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
|
|
4012
4419
|
* // }
|
|
4013
4420
|
* ```
|
|
4014
4421
|
*
|
|
4015
4422
|
* @example
|
|
4016
4423
|
* ```typescript
|
|
4017
4424
|
* const infoResult = await client.xinfoStream("my_stream", true); // default limit of 10 entries
|
|
4018
|
-
* const infoResult = await client.xinfoStream("my_stream", 15);
|
|
4425
|
+
* const infoResult = await client.xinfoStream("my_stream", 15); // limit of 15 entries
|
|
4019
4426
|
* console.log(infoResult);
|
|
4020
4427
|
* // Output: {
|
|
4021
|
-
* // "length": 2,
|
|
4022
|
-
* // "radix-tree-keys": 1,
|
|
4023
|
-
* // "radix-tree-nodes": 2,
|
|
4024
|
-
* // "last-generated-id": "1719877599564-1",
|
|
4025
|
-
* // "max-deleted-entry-id": "0-0",
|
|
4026
|
-
* // "entries-added": 2,
|
|
4027
|
-
* // "recorded-first-entry-id": "1719877599564-0",
|
|
4028
|
-
* // "entries": [ [ "1719877599564-0", ["some_field", "some_value", ...] ] ],
|
|
4029
|
-
* // "groups': [ {
|
|
4030
|
-
* // "name': "group",
|
|
4031
|
-
* // "last-delivered-id": "1719877599564-0",
|
|
4032
|
-
* // "entries-read": 1,
|
|
4033
|
-
* // "lag": 1,
|
|
4034
|
-
* // "pel-count": 1,
|
|
4035
|
-
* // "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.
|
|
4036
4443
|
* // "consumers": [ {
|
|
4037
|
-
* // "name": "consumer",
|
|
4038
|
-
* // "seen-time": 1722624726802,
|
|
4039
|
-
* // "active-time": 1722624726802,
|
|
4040
|
-
* // "pel-count": 1,
|
|
4041
|
-
* // "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.
|
|
4042
4449
|
* // }
|
|
4043
4450
|
* // ]
|
|
4044
4451
|
* // }
|
|
@@ -4062,7 +4469,8 @@ export declare class BaseClient {
|
|
|
4062
4469
|
* @example
|
|
4063
4470
|
* ```typescript
|
|
4064
4471
|
* // The consumer "myconsumer" was created in consumer group "mygroup" for the stream "mystream".
|
|
4065
|
-
* console.log(await client.xgroupCreateConsumer("mystream", "mygroup", "myconsumer"));
|
|
4472
|
+
* console.log(await client.xgroupCreateConsumer("mystream", "mygroup", "myconsumer"));
|
|
4473
|
+
* // Output: true
|
|
4066
4474
|
* ```
|
|
4067
4475
|
*/
|
|
4068
4476
|
xgroupCreateConsumer(key: GlideString, groupName: GlideString, consumerName: GlideString): Promise<boolean>;
|
|
@@ -4079,7 +4487,8 @@ export declare class BaseClient {
|
|
|
4079
4487
|
* * @example
|
|
4080
4488
|
* ```typescript
|
|
4081
4489
|
* // Consumer "myconsumer" was deleted, and had 5 pending messages unclaimed.
|
|
4082
|
-
* console.log(await client.xgroupDelConsumer("mystream", "mygroup", "myconsumer"));
|
|
4490
|
+
* console.log(await client.xgroupDelConsumer("mystream", "mygroup", "myconsumer"));
|
|
4491
|
+
* // Output: 5
|
|
4083
4492
|
* ```
|
|
4084
4493
|
*/
|
|
4085
4494
|
xgroupDelConsumer(key: GlideString, groupName: GlideString, consumerName: GlideString): Promise<number>;
|
|
@@ -4101,7 +4510,8 @@ export declare class BaseClient {
|
|
|
4101
4510
|
* // read messages from streamId
|
|
4102
4511
|
* const readResult = await client.xreadgroup(["myfield", "mydata"], "mygroup", "my0consumer");
|
|
4103
4512
|
* // acknowledge messages on stream
|
|
4104
|
-
* console.log(await client.xack("mystream", "mygroup", [entryId]));
|
|
4513
|
+
* console.log(await client.xack("mystream", "mygroup", [entryId]));
|
|
4514
|
+
* // Output: 1
|
|
4105
4515
|
* ```
|
|
4106
4516
|
*/
|
|
4107
4517
|
xack(key: GlideString, group: GlideString, ids: string[]): Promise<number>;
|
|
@@ -4120,7 +4530,8 @@ export declare class BaseClient {
|
|
|
4120
4530
|
*
|
|
4121
4531
|
* * @example
|
|
4122
4532
|
* ```typescript
|
|
4123
|
-
* console.log(await client.xgroupSetId("mystream", "mygroup", "0", { entriesRead: 1 }));
|
|
4533
|
+
* console.log(await client.xgroupSetId("mystream", "mygroup", "0", { entriesRead: 1 }));
|
|
4534
|
+
* // Output: "OK"
|
|
4124
4535
|
* ```
|
|
4125
4536
|
*/
|
|
4126
4537
|
xgroupSetId(key: GlideString, groupName: GlideString, id: string, options?: {
|
|
@@ -4143,14 +4554,18 @@ export declare class BaseClient {
|
|
|
4143
4554
|
* ```typescript
|
|
4144
4555
|
* // Example usage of lindex method to retrieve elements from a list by index
|
|
4145
4556
|
* const result = await client.lindex("my_list", 0);
|
|
4146
|
-
* console.log(result);
|
|
4557
|
+
* console.log(result);
|
|
4558
|
+
* // Output: 'value1'
|
|
4559
|
+
* // Returns the first element in the list stored at `my_list`.
|
|
4147
4560
|
* ```
|
|
4148
4561
|
*
|
|
4149
4562
|
* @example
|
|
4150
4563
|
* ```typescript
|
|
4151
4564
|
* // Example usage of lindex method to retrieve elements from a list by negative index
|
|
4152
4565
|
* const result = await client.lindex("my_list", -1);
|
|
4153
|
-
* console.log(result);
|
|
4566
|
+
* console.log(result);
|
|
4567
|
+
* // Output: 'value3'
|
|
4568
|
+
* // Returns the last element in the list stored at `my_list`.
|
|
4154
4569
|
* ```
|
|
4155
4570
|
*/
|
|
4156
4571
|
lindex(key: GlideString, index: number, options?: DecoderOption): Promise<GlideString | null>;
|
|
@@ -4171,7 +4586,9 @@ export declare class BaseClient {
|
|
|
4171
4586
|
* @example
|
|
4172
4587
|
* ```typescript
|
|
4173
4588
|
* const length = await client.linsert("my_list", InsertPosition.Before, "World", "There");
|
|
4174
|
-
* console.log(length);
|
|
4589
|
+
* console.log(length);
|
|
4590
|
+
* // Output: 2
|
|
4591
|
+
* // The list has a length of 2 after performing the insert.
|
|
4175
4592
|
* ```
|
|
4176
4593
|
*/
|
|
4177
4594
|
linsert(key: GlideString, position: InsertPosition, pivot: GlideString, element: GlideString): Promise<number>;
|
|
@@ -4188,7 +4605,9 @@ export declare class BaseClient {
|
|
|
4188
4605
|
* ```typescript
|
|
4189
4606
|
* // Example usage of persist method to remove the timeout associated with a key
|
|
4190
4607
|
* const result = await client.persist("my_key");
|
|
4191
|
-
* console.log(result);
|
|
4608
|
+
* console.log(result);
|
|
4609
|
+
* // Output: true
|
|
4610
|
+
* // Indicates that the timeout associated with the key `my_key` was successfully removed.
|
|
4192
4611
|
* ```
|
|
4193
4612
|
*/
|
|
4194
4613
|
persist(key: GlideString): Promise<boolean>;
|
|
@@ -4208,7 +4627,9 @@ export declare class BaseClient {
|
|
|
4208
4627
|
* // Example usage of rename method to rename a key
|
|
4209
4628
|
* await client.set("old_key", "value");
|
|
4210
4629
|
* const result = await client.rename("old_key", "new_key");
|
|
4211
|
-
* console.log(result);
|
|
4630
|
+
* console.log(result);
|
|
4631
|
+
* // Output: OK
|
|
4632
|
+
* // Indicates successful renaming of the key `old_key` to `new_key`.
|
|
4212
4633
|
* ```
|
|
4213
4634
|
*/
|
|
4214
4635
|
rename(key: GlideString, newKey: GlideString): Promise<"OK">;
|
|
@@ -4228,7 +4649,9 @@ export declare class BaseClient {
|
|
|
4228
4649
|
* // Example usage of renamenx method to rename a key
|
|
4229
4650
|
* await client.set("old_key", "value");
|
|
4230
4651
|
* const result = await client.renamenx("old_key", "new_key");
|
|
4231
|
-
* console.log(result);
|
|
4652
|
+
* console.log(result);
|
|
4653
|
+
* // Output: true
|
|
4654
|
+
* // Indicates successful renaming of the key `old_key` to `new_key`.
|
|
4232
4655
|
* ```
|
|
4233
4656
|
*/
|
|
4234
4657
|
renamenx(key: GlideString, newKey: GlideString): Promise<boolean>;
|
|
@@ -4251,7 +4674,9 @@ export declare class BaseClient {
|
|
|
4251
4674
|
* ```typescript
|
|
4252
4675
|
* // Example usage of brpop method to block and wait for elements from multiple lists
|
|
4253
4676
|
* const result = await client.brpop(["list1", "list2"], 5);
|
|
4254
|
-
* console.log(result);
|
|
4677
|
+
* console.log(result);
|
|
4678
|
+
* // Output: ["list1", "element"]
|
|
4679
|
+
* // Indicates an element `element` was popped from `list1`.
|
|
4255
4680
|
* ```
|
|
4256
4681
|
*/
|
|
4257
4682
|
brpop(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString] | null>;
|
|
@@ -4273,7 +4698,9 @@ export declare class BaseClient {
|
|
|
4273
4698
|
* @example
|
|
4274
4699
|
* ```typescript
|
|
4275
4700
|
* const result = await client.blpop(["list1", "list2"], 5);
|
|
4276
|
-
* console.log(result);
|
|
4701
|
+
* console.log(result);
|
|
4702
|
+
* // Output: ['list1', 'element']
|
|
4703
|
+
* // An element `element` popped from the list stored at key `list1`.
|
|
4277
4704
|
* ```
|
|
4278
4705
|
*/
|
|
4279
4706
|
blpop(keys: GlideString[], timeout: number, options?: DecoderOption): Promise<[GlideString, GlideString] | null>;
|
|
@@ -4290,9 +4717,14 @@ export declare class BaseClient {
|
|
|
4290
4717
|
* @example
|
|
4291
4718
|
* ```typescript
|
|
4292
4719
|
* const result = await client.pfadd("hll_1", ["a", "b", "c"]);
|
|
4293
|
-
* console.log(result);
|
|
4720
|
+
* console.log(result);
|
|
4721
|
+
* // Output: true
|
|
4722
|
+
* // Indicates that a data structure was created or modified.
|
|
4723
|
+
*
|
|
4294
4724
|
* const result = await client.pfadd("hll_2", []);
|
|
4295
|
-
* console.log(result);
|
|
4725
|
+
* console.log(result);
|
|
4726
|
+
* // Output: true
|
|
4727
|
+
* // Indicates that a new empty data structure was created.
|
|
4296
4728
|
* ```
|
|
4297
4729
|
*/
|
|
4298
4730
|
pfadd(key: GlideString, elements: GlideString[]): Promise<boolean>;
|
|
@@ -4308,7 +4740,9 @@ export declare class BaseClient {
|
|
|
4308
4740
|
* @example
|
|
4309
4741
|
* ```typescript
|
|
4310
4742
|
* const result = await client.pfcount(["hll_1", "hll_2"]);
|
|
4311
|
-
* console.log(result);
|
|
4743
|
+
* console.log(result);
|
|
4744
|
+
* // Output: 4
|
|
4745
|
+
* // The approximate cardinality of the union of `hll_1` and `hll_2`
|
|
4312
4746
|
* ```
|
|
4313
4747
|
*/
|
|
4314
4748
|
pfcount(keys: GlideString[]): Promise<number>;
|
|
@@ -4328,9 +4762,14 @@ export declare class BaseClient {
|
|
|
4328
4762
|
* await client.pfadd("hll1", ["a", "b"]);
|
|
4329
4763
|
* await client.pfadd("hll2", ["b", "c"]);
|
|
4330
4764
|
* const result = await client.pfmerge("new_hll", ["hll1", "hll2"]);
|
|
4331
|
-
* console.log(result);
|
|
4765
|
+
* console.log(result);
|
|
4766
|
+
* // Output: OK
|
|
4767
|
+
* // The value of `hll1` merged with `hll2` was stored in `new_hll`.
|
|
4768
|
+
*
|
|
4332
4769
|
* const count = await client.pfcount(["new_hll"]);
|
|
4333
|
-
* console.log(count);
|
|
4770
|
+
* console.log(count);
|
|
4771
|
+
* // Output: 3
|
|
4772
|
+
* // The approximate cardinality of `new_hll` is 3.
|
|
4334
4773
|
* ```
|
|
4335
4774
|
*/
|
|
4336
4775
|
pfmerge(destination: GlideString, sourceKeys: GlideString[]): Promise<"OK">;
|
|
@@ -4346,7 +4785,8 @@ export declare class BaseClient {
|
|
|
4346
4785
|
* @example
|
|
4347
4786
|
* ```typescript
|
|
4348
4787
|
* const result = await client.objectEncoding("my_hash");
|
|
4349
|
-
* console.log(result);
|
|
4788
|
+
* console.log(result);
|
|
4789
|
+
* // Output: "listpack"
|
|
4350
4790
|
* ```
|
|
4351
4791
|
*/
|
|
4352
4792
|
objectEncoding(key: GlideString): Promise<string | null>;
|
|
@@ -4362,7 +4802,9 @@ export declare class BaseClient {
|
|
|
4362
4802
|
* @example
|
|
4363
4803
|
* ```typescript
|
|
4364
4804
|
* const result = await client.objectFreq("my_hash");
|
|
4365
|
-
* console.log(result);
|
|
4805
|
+
* console.log(result);
|
|
4806
|
+
* // Output: 2
|
|
4807
|
+
* // The logarithmic access frequency counter of `my_hash`.
|
|
4366
4808
|
* ```
|
|
4367
4809
|
*/
|
|
4368
4810
|
objectFreq(key: GlideString): Promise<number | null>;
|
|
@@ -4377,7 +4819,9 @@ export declare class BaseClient {
|
|
|
4377
4819
|
* @example
|
|
4378
4820
|
* ```typescript
|
|
4379
4821
|
* const result = await client.objectIdletime("my_hash");
|
|
4380
|
-
* console.log(result);
|
|
4822
|
+
* console.log(result);
|
|
4823
|
+
* // Output: 13
|
|
4824
|
+
* // `my_hash` was last accessed 13 seconds ago.
|
|
4381
4825
|
* ```
|
|
4382
4826
|
*/
|
|
4383
4827
|
objectIdletime(key: GlideString): Promise<number | null>;
|
|
@@ -4393,7 +4837,9 @@ export declare class BaseClient {
|
|
|
4393
4837
|
* @example
|
|
4394
4838
|
* ```typescript
|
|
4395
4839
|
* const result = await client.objectRefcount("my_hash");
|
|
4396
|
-
* console.log(result);
|
|
4840
|
+
* console.log(result);
|
|
4841
|
+
* // Output: 2
|
|
4842
|
+
* // `my_hash` has a reference count of 2.
|
|
4397
4843
|
* ```
|
|
4398
4844
|
*/
|
|
4399
4845
|
objectRefcount(key: GlideString): Promise<number | null>;
|
|
@@ -4414,7 +4860,7 @@ export declare class BaseClient {
|
|
|
4414
4860
|
* @example
|
|
4415
4861
|
* ```typescript
|
|
4416
4862
|
* const response = await client.fcall("Deep_Thought", [], []);
|
|
4417
|
-
* console.log(response); //
|
|
4863
|
+
* console.log(response); // Returns the function's return value.
|
|
4418
4864
|
* ```
|
|
4419
4865
|
*/
|
|
4420
4866
|
fcall(func: GlideString, keys: GlideString[], args: GlideString[], options?: DecoderOption): Promise<GlideReturnType>;
|
|
@@ -4436,7 +4882,9 @@ export declare class BaseClient {
|
|
|
4436
4882
|
* ```typescript
|
|
4437
4883
|
* const response = await client.fcallReadOnly("Deep_Thought", ["key1"], ["Answer", "to", "the",
|
|
4438
4884
|
* "Ultimate", "Question", "of", "Life,", "the", "Universe,", "and", "Everything"]);
|
|
4439
|
-
* console.log(response);
|
|
4885
|
+
* console.log(response);
|
|
4886
|
+
* // Output: 42
|
|
4887
|
+
* // The return value on the function that was executed.
|
|
4440
4888
|
* ```
|
|
4441
4889
|
*/
|
|
4442
4890
|
fcallReadonly(func: GlideString, keys: GlideString[], args: GlideString[], options?: DecoderOption): Promise<GlideReturnType>;
|
|
@@ -4457,8 +4905,13 @@ export declare class BaseClient {
|
|
|
4457
4905
|
* @example
|
|
4458
4906
|
* ```typescript
|
|
4459
4907
|
* await client.rpush("myList", ["a", "b", "c", "d", "e", "e"]);
|
|
4460
|
-
* console.log(await client.lpos("myList", "e", { rank: 2 }));
|
|
4461
|
-
*
|
|
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`.
|
|
4462
4915
|
* ```
|
|
4463
4916
|
*/
|
|
4464
4917
|
lpos(key: GlideString, element: GlideString, options?: LPosOptions): Promise<number | number[] | null>;
|
|
@@ -4476,11 +4929,25 @@ export declare class BaseClient {
|
|
|
4476
4929
|
*
|
|
4477
4930
|
* @example
|
|
4478
4931
|
* ```typescript
|
|
4479
|
-
* console.log(await client.bitcount("my_key1"));
|
|
4480
|
-
*
|
|
4481
|
-
*
|
|
4482
|
-
*
|
|
4483
|
-
* 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.
|
|
4484
4951
|
* ```
|
|
4485
4952
|
*/
|
|
4486
4953
|
bitcount(key: GlideString, options?: BitOffsetOptions): Promise<number>;
|
|
@@ -4505,7 +4972,9 @@ export declare class BaseClient {
|
|
|
4505
4972
|
* ["Palermo", { longitude: 13.361389, latitude: 38.115556 }],
|
|
4506
4973
|
* ]);
|
|
4507
4974
|
* const num = await client.geoadd("mySortedSet", membersToCoordinates, options);
|
|
4508
|
-
* 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.
|
|
4509
4978
|
* ```
|
|
4510
4979
|
*/
|
|
4511
4980
|
geoadd(key: GlideString, membersToGeospatialData: Map<GlideString, GeospatialData>, options?: GeoAddOptions): Promise<number>;
|
|
@@ -4539,7 +5008,9 @@ export declare class BaseClient {
|
|
|
4539
5008
|
* await client.geoadd("mySortedSet", data);
|
|
4540
5009
|
* // search for locations within 200 km circle around stored member named 'Palermo'
|
|
4541
5010
|
* const result1 = await client.geosearch("mySortedSet", { member: "Palermo" }, { radius: 200, unit: GeoUnit.KILOMETERS });
|
|
4542
|
-
* console.log(result1);
|
|
5011
|
+
* console.log(result1);
|
|
5012
|
+
* // Output: ['Palermo', 'Catania']
|
|
5013
|
+
* // Locations within the specified radius.
|
|
4543
5014
|
*
|
|
4544
5015
|
* // search for locations in 200x300 mi rectangle centered at coordinate (15, 37), requesting additional info,
|
|
4545
5016
|
* // limiting results by 2 best matches, ordered by ascending distance from the search area center
|
|
@@ -4555,7 +5026,8 @@ export declare class BaseClient {
|
|
|
4555
5026
|
* withHash: true,
|
|
4556
5027
|
* },
|
|
4557
5028
|
* );
|
|
4558
|
-
* console.log(result2);
|
|
5029
|
+
* console.log(result2);
|
|
5030
|
+
* // Output:
|
|
4559
5031
|
* // [
|
|
4560
5032
|
* // [
|
|
4561
5033
|
* // 'Catania', // location name
|
|
@@ -4609,7 +5081,8 @@ export declare class BaseClient {
|
|
|
4609
5081
|
* await client.geosearchstore("destination", "mySortedSet", { member: "Palermo" }, { radius: 200, unit: GeoUnit.KILOMETERS });
|
|
4610
5082
|
* // query the stored results
|
|
4611
5083
|
* const result1 = await client.zrangeWithScores("destination", { start: 0, end: -1 });
|
|
4612
|
-
* console.log(result1);
|
|
5084
|
+
* console.log(result1);
|
|
5085
|
+
* // Output:
|
|
4613
5086
|
* // {
|
|
4614
5087
|
* // Palermo: 3479099956230698, // geohash of the location is stored as element's score
|
|
4615
5088
|
* // Catania: 3479447370796909
|
|
@@ -4630,7 +5103,8 @@ export declare class BaseClient {
|
|
|
4630
5103
|
* );
|
|
4631
5104
|
* // query the stored results
|
|
4632
5105
|
* const result2 = await client.zrangeWithScores("destination", { start: 0, end: -1 });
|
|
4633
|
-
* console.log(result2);
|
|
5106
|
+
* console.log(result2);
|
|
5107
|
+
* // Output:
|
|
4634
5108
|
* // {
|
|
4635
5109
|
* // Palermo: 190.4424, // distance from the search area center is stored as element's score
|
|
4636
5110
|
* // Catania: 56.4413, // the distance is measured in units used for the search query (miles)
|
|
@@ -4657,11 +5131,12 @@ export declare class BaseClient {
|
|
|
4657
5131
|
* const result = await client.geopos("mySortedSet", ["Palermo", "Catania", "NonExisting"]);
|
|
4658
5132
|
* // When added via GEOADD, the geospatial coordinates are converted into a 52 bit geohash, so the coordinates
|
|
4659
5133
|
* // returned might not be exactly the same as the input values
|
|
4660
|
-
* console.log(result);
|
|
5134
|
+
* console.log(result);
|
|
5135
|
+
* // Output:
|
|
4661
5136
|
* // [
|
|
4662
|
-
* // [13.36138933897018433, 38.11555639549629859],
|
|
4663
|
-
* // [15.08726745843887329, 37.50266842333162032],
|
|
4664
|
-
* // 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.
|
|
4665
5140
|
* // ]
|
|
4666
5141
|
* ```
|
|
4667
5142
|
*/
|
|
@@ -4690,11 +5165,11 @@ export declare class BaseClient {
|
|
|
4690
5165
|
* await client.zadd("zSet2", { four: 4.0 });
|
|
4691
5166
|
* console.log(await client.zmpop(["zSet1", "zSet2"], ScoreFilter.MAX, 2));
|
|
4692
5167
|
* // Output:
|
|
4693
|
-
* // "three" with score 3 and "two" with score 2 were popped from "zSet1"
|
|
4694
5168
|
* // [ "zSet1", [
|
|
4695
5169
|
* // { element: 'three', score: 3 },
|
|
4696
5170
|
* // { element: 'two', score: 2 }
|
|
4697
5171
|
* // ] ]
|
|
5172
|
+
* // `three` with score 3 and `two` with score 2 were popped from `zSet1`.
|
|
4698
5173
|
* ```
|
|
4699
5174
|
*/
|
|
4700
5175
|
zmpop(keys: GlideString[], modifier: ScoreFilter, options?: {
|
|
@@ -4728,11 +5203,11 @@ export declare class BaseClient {
|
|
|
4728
5203
|
* await client.zadd("zSet2", { four: 4.0 });
|
|
4729
5204
|
* console.log(await client.bzmpop(["zSet1", "zSet2"], ScoreFilter.MAX, 0.1, 2));
|
|
4730
5205
|
* // Output:
|
|
4731
|
-
* // "three" with score 3 and "two" with score 2 were popped from "zSet1"
|
|
4732
5206
|
* // [ "zSet1", [
|
|
4733
5207
|
* // { element: 'three', score: 3 },
|
|
4734
5208
|
* // { element: 'two', score: 2 }
|
|
4735
5209
|
* // ] ]
|
|
5210
|
+
* // `three` with score 3 and `two` with score 2 were popped from `zSet1`
|
|
4736
5211
|
* ```
|
|
4737
5212
|
*/
|
|
4738
5213
|
bzmpop(keys: GlideString[], modifier: ScoreFilter, timeout: number, options?: {
|
|
@@ -4755,12 +5230,18 @@ export declare class BaseClient {
|
|
|
4755
5230
|
* ```typescript
|
|
4756
5231
|
* // Example usage of zincrBy method to increment the value of a member's score
|
|
4757
5232
|
* await client.zadd("my_sorted_set", {"member": 10.5, "member2": 8.2});
|
|
5233
|
+
*
|
|
4758
5234
|
* console.log(await client.zincrby("my_sorted_set", 1.2, "member"));
|
|
4759
|
-
* // 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
|
+
*
|
|
4760
5238
|
* console.log(await client.zincrby("my_sorted_set", -1.7, "member"));
|
|
4761
|
-
* // Output: 10.0
|
|
5239
|
+
* // Output: 10.0
|
|
5240
|
+
* // Negative increment, decrements the score.
|
|
5241
|
+
*
|
|
4762
5242
|
* console.log(await client.zincrby("my_sorted_set", 5.5, "non_existing_member"));
|
|
4763
|
-
* // Output: 5.5
|
|
5243
|
+
* // Output: 5.5
|
|
5244
|
+
* // A new member is added to the sorted set with the score of 5.5.
|
|
4764
5245
|
* ```
|
|
4765
5246
|
*/
|
|
4766
5247
|
zincrby(key: GlideString, increment: number, member: GlideString): Promise<number>;
|
|
@@ -4845,7 +5326,8 @@ export declare class BaseClient {
|
|
|
4845
5326
|
* @example
|
|
4846
5327
|
* ```typescript
|
|
4847
5328
|
* const result = await client.geodist("mySortedSet", "Place1", "Place2", { unit: GeoUnit.KILOMETERS });
|
|
4848
|
-
* console.log(num);
|
|
5329
|
+
* console.log(num);
|
|
5330
|
+
* // Output: the distance between Place1 and Place2.
|
|
4849
5331
|
* ```
|
|
4850
5332
|
*/
|
|
4851
5333
|
geodist(key: GlideString, member1: GlideString, member2: GlideString, options?: {
|
|
@@ -4864,7 +5346,9 @@ export declare class BaseClient {
|
|
|
4864
5346
|
* @example
|
|
4865
5347
|
* ```typescript
|
|
4866
5348
|
* const result = await client.geohash("mySortedSet", ["Palermo", "Catania", "NonExisting"]);
|
|
4867
|
-
* console.log(result);
|
|
5349
|
+
* console.log(result);
|
|
5350
|
+
* // Output: ["sqc8b49rny0", "sqdtr74hyu0", null]
|
|
5351
|
+
* // An array of GeoHash string.
|
|
4868
5352
|
* ```
|
|
4869
5353
|
*/
|
|
4870
5354
|
geohash(key: GlideString, members: GlideString[]): Promise<(string | null)[]>;
|
|
@@ -4885,7 +5369,9 @@ export declare class BaseClient {
|
|
|
4885
5369
|
* ```typescript
|
|
4886
5370
|
* await client.mset({"testKey1": "abcd", "testKey2": "axcd"});
|
|
4887
5371
|
* const result = await client.lcs("testKey1", "testKey2");
|
|
4888
|
-
* console.log(result);
|
|
5372
|
+
* console.log(result);
|
|
5373
|
+
* // Output: 'acd'
|
|
5374
|
+
* // Returned the longest common subsequence of strings stored at `testKey1` and `testKey2`.
|
|
4889
5375
|
* ```
|
|
4890
5376
|
*/
|
|
4891
5377
|
lcs(key1: GlideString, key2: GlideString, options?: DecoderOption): Promise<string>;
|
|
@@ -4905,7 +5391,9 @@ export declare class BaseClient {
|
|
|
4905
5391
|
* ```typescript
|
|
4906
5392
|
* await client.mset({"testKey1": "abcd", "testKey2": "axcd"});
|
|
4907
5393
|
* const result = await client.lcsLen("testKey1", "testKey2");
|
|
4908
|
-
* 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`.
|
|
4909
5397
|
* ```
|
|
4910
5398
|
*/
|
|
4911
5399
|
lcsLen(key1: GlideString, key2: GlideString, options?: DecoderOption): Promise<number>;
|
|
@@ -4937,7 +5425,8 @@ export declare class BaseClient {
|
|
|
4937
5425
|
* ```typescript
|
|
4938
5426
|
* await client.mset({"key1": "ohmytext", "key2": "mynewtext"});
|
|
4939
5427
|
* const result = await client.lcsIdx("key1", "key2");
|
|
4940
|
-
* console.log(result);
|
|
5428
|
+
* console.log(result);
|
|
5429
|
+
* // Output:
|
|
4941
5430
|
* {
|
|
4942
5431
|
* "matches" :
|
|
4943
5432
|
* [
|
|
@@ -4981,7 +5470,9 @@ export declare class BaseClient {
|
|
|
4981
5470
|
* await client.set("key1", "value1");
|
|
4982
5471
|
* await client.set("key2", "value2");
|
|
4983
5472
|
* const result = await client.touch(["key1", "key2", "nonExistingKey"]);
|
|
4984
|
-
* console.log(result);
|
|
5473
|
+
* console.log(result);
|
|
5474
|
+
* // Output: 2
|
|
5475
|
+
* // The last access time of 2 keys has been updated.
|
|
4985
5476
|
* ```
|
|
4986
5477
|
*/
|
|
4987
5478
|
touch(keys: GlideString[]): Promise<number>;
|
|
@@ -5006,18 +5497,27 @@ export declare class BaseClient {
|
|
|
5006
5497
|
* @example
|
|
5007
5498
|
* ```typescript
|
|
5008
5499
|
* const response = await client.watch(["sampleKey"]);
|
|
5009
|
-
* console.log(response);
|
|
5500
|
+
* console.log(response);
|
|
5501
|
+
* // Output: "OK"
|
|
5502
|
+
*
|
|
5010
5503
|
* const transaction = new Batch(true).set("SampleKey", "foobar");
|
|
5011
5504
|
* const result = await client.exec(transaction);
|
|
5012
|
-
* console.log(result);
|
|
5505
|
+
* console.log(result);
|
|
5506
|
+
*
|
|
5507
|
+
* // Output: "OK"
|
|
5508
|
+
* // Executes successfully and keys are unwatched.
|
|
5013
5509
|
* ```
|
|
5014
5510
|
* ```typescript
|
|
5015
5511
|
* const response = await client.watch(["sampleKey"]);
|
|
5016
|
-
* console.log(response);
|
|
5512
|
+
* console.log(response);
|
|
5513
|
+
* // Output: "OK"
|
|
5514
|
+
*
|
|
5017
5515
|
* const transaction = new Batch(true).set("SampleKey", "foobar");
|
|
5018
5516
|
* await client.set("sampleKey", "hello world");
|
|
5019
5517
|
* const result = await client.exec(transaction);
|
|
5020
|
-
* console.log(result);
|
|
5518
|
+
* console.log(result);
|
|
5519
|
+
* // Output: null
|
|
5520
|
+
* // null is returned when the watched key is modified before transaction execution.
|
|
5021
5521
|
* ```
|
|
5022
5522
|
*/
|
|
5023
5523
|
watch(keys: GlideString[]): Promise<"OK">;
|
|
@@ -5036,7 +5536,8 @@ export declare class BaseClient {
|
|
|
5036
5536
|
* ```typescript
|
|
5037
5537
|
* await client.set(key, value);
|
|
5038
5538
|
* let response = await client.wait(1, 1000);
|
|
5039
|
-
* console.log(response);
|
|
5539
|
+
* console.log(response);
|
|
5540
|
+
* // Output: return 1 when a replica is reached or 0 if 1000ms is reached.
|
|
5040
5541
|
* ```
|
|
5041
5542
|
*/
|
|
5042
5543
|
wait(numreplicas: number, timeout: number): Promise<number>;
|
|
@@ -5055,9 +5556,14 @@ export declare class BaseClient {
|
|
|
5055
5556
|
* @example
|
|
5056
5557
|
* ```typescript
|
|
5057
5558
|
* const len = await client.setrange("key", 6, "GLIDE");
|
|
5058
|
-
* console.log(len);
|
|
5559
|
+
* console.log(len);
|
|
5560
|
+
* // Output: 11
|
|
5561
|
+
* // New key was created with length of 11 symbols
|
|
5562
|
+
*
|
|
5059
5563
|
* const value = await client.get("key");
|
|
5060
|
-
* console.log(result);
|
|
5564
|
+
* console.log(result);
|
|
5565
|
+
* // Output: "\0\0\0\0\0\0GLIDE"
|
|
5566
|
+
* // The string was padded with zero bytes
|
|
5061
5567
|
* ```
|
|
5062
5568
|
*/
|
|
5063
5569
|
setrange(key: GlideString, offset: number, value: GlideString): Promise<number>;
|
|
@@ -5075,12 +5581,15 @@ export declare class BaseClient {
|
|
|
5075
5581
|
* ```typescript
|
|
5076
5582
|
* const len = await client.append("key", "Hello");
|
|
5077
5583
|
* console.log(len);
|
|
5078
|
-
*
|
|
5079
|
-
*
|
|
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
|
+
*
|
|
5080
5588
|
* len = await client.append("key", " world");
|
|
5081
5589
|
* console.log(result);
|
|
5082
|
-
*
|
|
5083
|
-
*
|
|
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.
|
|
5084
5593
|
* ```
|
|
5085
5594
|
*/
|
|
5086
5595
|
append(key: GlideString, value: GlideString): Promise<number>;
|
|
@@ -5104,7 +5613,8 @@ export declare class BaseClient {
|
|
|
5104
5613
|
* await client.lpush("testKey", ["one", "two", "three"]);
|
|
5105
5614
|
* await client.lpush("testKey2", ["five", "six", "seven"]);
|
|
5106
5615
|
* const result = await client.lmpop(["testKey", "testKey2"], ListDirection.LEFT, 1L);
|
|
5107
|
-
* console.log(result);
|
|
5616
|
+
* console.log(result);
|
|
5617
|
+
* // Output: { key: "testKey", elements: ["three"] }
|
|
5108
5618
|
* ```
|
|
5109
5619
|
*/
|
|
5110
5620
|
lmpop(keys: GlideString[], direction: ListDirection, options?: {
|
|
@@ -5135,7 +5645,8 @@ export declare class BaseClient {
|
|
|
5135
5645
|
* await client.lpush("testKey", ["one", "two", "three"]);
|
|
5136
5646
|
* await client.lpush("testKey2", ["five", "six", "seven"]);
|
|
5137
5647
|
* const result = await client.blmpop(["testKey", "testKey2"], ListDirection.LEFT, 0.1, 1);
|
|
5138
|
-
* console.log(result"testKey");
|
|
5648
|
+
* console.log(result"testKey");
|
|
5649
|
+
* // Output: { key: "testKey", elements: ["three"] }
|
|
5139
5650
|
* ```
|
|
5140
5651
|
*/
|
|
5141
5652
|
blmpop(keys: GlideString[], direction: ListDirection, timeout: number, options?: {
|
|
@@ -5160,10 +5671,12 @@ export declare class BaseClient {
|
|
|
5160
5671
|
* @example
|
|
5161
5672
|
* ```typescript
|
|
5162
5673
|
* const channels = await client.pubsubChannels();
|
|
5163
|
-
* console.log(channels);
|
|
5674
|
+
* console.log(channels);
|
|
5675
|
+
* // Output: ["channel1", "channel2"]
|
|
5164
5676
|
*
|
|
5165
5677
|
* const newsChannels = await client.pubsubChannels("news.*");
|
|
5166
|
-
* console.log(newsChannels);
|
|
5678
|
+
* console.log(newsChannels);
|
|
5679
|
+
* // Output: ["news.sports", "news.weather"]
|
|
5167
5680
|
* ```
|
|
5168
5681
|
*/
|
|
5169
5682
|
pubsubChannels(options?: {
|
|
@@ -5183,7 +5696,8 @@ export declare class BaseClient {
|
|
|
5183
5696
|
* @example
|
|
5184
5697
|
* ```typescript
|
|
5185
5698
|
* const patternCount = await client.pubsubNumpat();
|
|
5186
|
-
* console.log(patternCount);
|
|
5699
|
+
* console.log(patternCount);
|
|
5700
|
+
* // Output: 3
|
|
5187
5701
|
* ```
|
|
5188
5702
|
*/
|
|
5189
5703
|
pubsubNumPat(): Promise<number>;
|
|
@@ -5200,11 +5714,12 @@ export declare class BaseClient {
|
|
|
5200
5714
|
* @example
|
|
5201
5715
|
* ```typescript
|
|
5202
5716
|
* const result1 = await client.pubsubNumsub(["channel1", "channel2"]);
|
|
5203
|
-
* console.log(result1);
|
|
5204
|
-
* // [{ channel: "channel1", numSub: 3}, { channel: "channel2", numSub: 5 }]
|
|
5717
|
+
* console.log(result1);
|
|
5718
|
+
* // Output: [{ channel: "channel1", numSub: 3}, { channel: "channel2", numSub: 5 }]
|
|
5205
5719
|
*
|
|
5206
5720
|
* const result2 = await client.pubsubNumsub([]);
|
|
5207
|
-
* console.log(result2);
|
|
5721
|
+
* console.log(result2);
|
|
5722
|
+
* // Output: []
|
|
5208
5723
|
* ```
|
|
5209
5724
|
*/
|
|
5210
5725
|
pubsubNumSub(channels: GlideString[], options?: DecoderOption): Promise<{
|
|
@@ -5234,7 +5749,9 @@ export declare class BaseClient {
|
|
|
5234
5749
|
* await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
|
|
5235
5750
|
* await client.lpush("user_ids", ["2", "1"]);
|
|
5236
5751
|
* const result = await client.sort("user_ids", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
|
|
5237
|
-
* console.log(result);
|
|
5752
|
+
* console.log(result);
|
|
5753
|
+
* // Output: [ 'Bob', 'Alice' ]
|
|
5754
|
+
* // Returns a list of the names sorted by age
|
|
5238
5755
|
* ```
|
|
5239
5756
|
*/
|
|
5240
5757
|
sort(key: GlideString, options?: SortOptions & DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -5261,7 +5778,9 @@ export declare class BaseClient {
|
|
|
5261
5778
|
* await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
|
|
5262
5779
|
* await client.lpush("user_ids", ["2", "1"]);
|
|
5263
5780
|
* const result = await client.sortReadOnly("user_ids", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
|
|
5264
|
-
* console.log(result);
|
|
5781
|
+
* console.log(result);
|
|
5782
|
+
* // Output: [ 'Bob', 'Alice' ]
|
|
5783
|
+
* // Returns a list of the names sorted by age
|
|
5265
5784
|
* ```
|
|
5266
5785
|
*/
|
|
5267
5786
|
sortReadOnly(key: GlideString, options?: SortOptions & DecoderOption): Promise<(GlideString | null)[]>;
|
|
@@ -5290,8 +5809,13 @@ export declare class BaseClient {
|
|
|
5290
5809
|
* await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
|
|
5291
5810
|
* await client.lpush("user_ids", ["2", "1"]);
|
|
5292
5811
|
* const sortedElements = await client.sortStore("user_ids", "sortedList", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
|
|
5293
|
-
* console.log(sortedElements);
|
|
5294
|
-
*
|
|
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`
|
|
5295
5819
|
* ```
|
|
5296
5820
|
*/
|
|
5297
5821
|
sortStore(key: GlideString, destination: GlideString, options?: SortOptions): Promise<number>;
|
|
@@ -5317,7 +5841,8 @@ export declare class BaseClient {
|
|
|
5317
5841
|
*
|
|
5318
5842
|
* @example
|
|
5319
5843
|
* ```typescript
|
|
5320
|
-
* await client.updateConnectionPassword("newPassword", true)
|
|
5844
|
+
* await client.updateConnectionPassword("newPassword", true)
|
|
5845
|
+
* // Output: "OK"
|
|
5321
5846
|
* ```
|
|
5322
5847
|
*/
|
|
5323
5848
|
updateConnectionPassword(password: string | null, immediateAuth?: boolean): Promise<GlideString>;
|