@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.
@@ -721,10 +721,13 @@ class BaseClient {
721
721
  * ```typescript
722
722
  * // Example usage of get method to retrieve the value of a key
723
723
  * const result = await client.get("key");
724
- * console.log(result); // Output: 'value'
724
+ * console.log(result);
725
+ * // Output: 'value'
726
+ *
725
727
  * // Example usage of get method to retrieve the value of a key with Bytes decoder
726
728
  * const result = await client.get("key", { decoder: Decoder.Bytes });
727
- * console.log(result); // Output: <Buffer 76 61 6c 75 65>
729
+ * console.log(result);
730
+ * // Output: <Buffer 76 61 6c 75 65>
728
731
  * ```
729
732
  */
730
733
  async get(key, options) {
@@ -747,7 +750,8 @@ class BaseClient {
747
750
  * @example
748
751
  * ```typescript
749
752
  * const result = await client.getex("key", {expiry: { type: TimeUnit.Seconds, count: 5 }});
750
- * console.log(result); // Output: 'value'
753
+ * console.log(result);
754
+ * // Output: 'value'
751
755
  * ```
752
756
  */
753
757
  async getex(key, options) {
@@ -765,7 +769,8 @@ class BaseClient {
765
769
  * @example
766
770
  * ```typescript
767
771
  * const result = client.getdel("key");
768
- * console.log(result); // Output: 'value'
772
+ * console.log(result);
773
+ * // Output: 'value'
769
774
  *
770
775
  * const value = client.getdel("key"); // value is null
771
776
  * ```
@@ -792,13 +797,21 @@ class BaseClient {
792
797
  * ```typescript
793
798
  * await client.set("mykey", "This is a string")
794
799
  * let result = await client.getrange("mykey", 0, 3)
795
- * console.log(result); // Output: "This"
800
+ * console.log(result);
801
+ * // Output: "This"
802
+ *
796
803
  * result = await client.getrange("mykey", -3, -1)
797
- * console.log(result); // Output: "ing" - extracted last 3 characters of a string
804
+ * console.log(result);
805
+ * // Output: "ing"
806
+ * // extracted last 3 characters of a string
807
+ *
798
808
  * result = await client.getrange("mykey", 0, 100)
799
- * console.log(result); // Output: "This is a string"
809
+ * console.log(result);
810
+ * // Output: "This is a string"
811
+ *
800
812
  * result = await client.getrange("mykey", 5, 6)
801
- * console.log(result); // Output: ""
813
+ * console.log(result);
814
+ * // Output: ""
802
815
  * ```
803
816
  */
804
817
  async getrange(key, start, end, options) {
@@ -824,22 +837,33 @@ class BaseClient {
824
837
  *
825
838
  * // Example usage of set method with conditional options and expiration
826
839
  * const result2 = await client.set("key", "new_value", {conditionalSet: "onlyIfExists", expiry: { type: TimeUnit.Seconds, count: 5 }});
827
- * console.log(result2); // Output: 'OK' - Set "new_value" to "key" only if "key" already exists, and set the key expiration to 5 seconds.
840
+ * console.log(result2);
841
+ * // Output: 'OK'
842
+ * // Set "new_value" to `key" only if `key` already exists, and set the key expiration to 5 seconds.
828
843
  *
829
844
  * // Example usage of set method with conditional options and returning old value
830
845
  * const result3 = await client.set("key", "value", {conditionalSet: "onlyIfDoesNotExist", returnOldValue: true});
831
- * console.log(result3); // Output: 'new_value' - Returns the old value of "key".
846
+ * console.log(result3);
847
+ * // Output: 'new_value'
848
+ * // Returns the old value of `key`.
832
849
  *
833
850
  * // Example usage of get method to retrieve the value of a key
834
851
  * const result4 = await client.get("key");
835
- * console.log(result4); // Output: 'new_value' - Value wasn't modified back to being "value" because of "NX" flag.
852
+ * console.log(result4);
853
+ * // Output: 'new_value'
854
+ * // Value wasn't modified back to being "value" because of "NX" flag.
836
855
  *
837
856
  * // Example usage of set method with conditional option IFEQ
838
857
  * await client.set("key", "value we will compare to");
839
858
  * const result5 = await client.set("key", "new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
840
- * console.log(result5); // Output: 'OK' - Set "new_value" to "key" only if comparisonValue is equal to the current value of "key".
859
+ * console.log(result5);
860
+ * // Output: 'OK'
861
+ * // Set "new_value" to "key" only if comparisonValue is equal to the current value of "key".
862
+ *
841
863
  * const result6 = await client.set("key", "another_new_value", {conditionalSet: "onlyIfEqual", comparisonValue: "value we will compare to"});
842
- * console.log(result6); // Output: `null` - Value wasn't set because the comparisonValue is not equal to the current value of "key". Value of "key" remains "new_value".
864
+ * console.log(result6);
865
+ * // Output: null
866
+ * // Value wasn't set because the comparisonValue is not equal to the current value of `key`. Value of `key` remains "new_value".
843
867
  * ```
844
868
  */
845
869
  async set(key, value, options) {
@@ -890,13 +914,15 @@ class BaseClient {
890
914
  * @example
891
915
  * ```typescript
892
916
  * let result = await client.dump("myKey");
893
- * console.log(result); // Output: the serialized value of "myKey"
917
+ * console.log(result);
918
+ * // Result contains the serialized value of `myKey`
894
919
  * ```
895
920
  *
896
921
  * @example
897
922
  * ```typescript
898
923
  * result = await client.dump("nonExistingKey");
899
- * console.log(result); // Output: `null`
924
+ * console.log(result);
925
+ * // Output: null
900
926
  * ```
901
927
  */
902
928
  async dump(key) {
@@ -967,7 +993,8 @@ class BaseClient {
967
993
  * await client.set("key1", "value1");
968
994
  * await client.set("key2", "value2");
969
995
  * const result = await client.mget(["key1", "key2"]);
970
- * console.log(result); // Output: ['value1', 'value2']
996
+ * console.log(result);
997
+ * // Output: ['value1', 'value2']
971
998
  * ```
972
999
  */
973
1000
  async mget(keys, options) {
@@ -1140,10 +1167,14 @@ class BaseClient {
1140
1167
  * await client.set("key1", "A"); // "A" has binary value 01000001
1141
1168
  * await client.set("key2", "B"); // "B" has binary value 01000010
1142
1169
  * const result1 = await client.bitop(BitwiseOperation.AND, "destination", ["key1", "key2"]);
1143
- * console.log(result1); // Output: 1 - The size of the resulting string stored in "destination" is 1.
1170
+ * console.log(result1);
1171
+ * // Output: 1
1172
+ * // The size of the resulting string stored in "destination" is 1.
1144
1173
  *
1145
1174
  * const result2 = await client.get("destination");
1146
- * console.log(result2); // Output: "@" - "@" has binary value 01000000
1175
+ * console.log(result2);
1176
+ * // Output: "@"
1177
+ * // "@" has binary value 01000000
1147
1178
  * ```
1148
1179
  */
1149
1180
  async bitop(operation, destination, keys) {
@@ -1163,7 +1194,9 @@ class BaseClient {
1163
1194
  * @example
1164
1195
  * ```typescript
1165
1196
  * const result = await client.getbit("key", 1);
1166
- * console.log(result); // Output: 1 - The second bit of the string stored at "key" is set to 1.
1197
+ * console.log(result);
1198
+ * // Output: 1
1199
+ * // The second bit of the string stored at `key` is set to 1.
1167
1200
  * ```
1168
1201
  */
1169
1202
  async getbit(key, offset) {
@@ -1185,7 +1218,9 @@ class BaseClient {
1185
1218
  * @example
1186
1219
  * ```typescript
1187
1220
  * const result = await client.setbit("key", 1, 1);
1188
- * console.log(result); // Output: 0 - The second bit value was 0 before setting to 1.
1221
+ * console.log(result);
1222
+ * // Output: 0
1223
+ * // The second bit value was 0 before setting to 1.
1189
1224
  * ```
1190
1225
  */
1191
1226
  async setbit(key, offset, value) {
@@ -1210,17 +1245,25 @@ class BaseClient {
1210
1245
  * ```typescript
1211
1246
  * await client.set("key1", "A1"); // "A1" has binary value 01000001 00110001
1212
1247
  * const result1 = await client.bitpos("key1", 1);
1213
- * console.log(result1); // Output: 1 - The first occurrence of bit value 1 in the string stored at "key1" is at the second position.
1248
+ * console.log(result1);
1249
+ * // Output: 1
1250
+ * // The first occurrence of bit value 1 in the string stored at `key1` is at the second position.
1214
1251
  *
1215
1252
  * const result2 = await client.bitpos("key1", 1, { start: -1 });
1216
- * console.log(result2); // Output: 10 - The first occurrence of bit value 1, starting at the last byte in the string stored at "key1", is at the eleventh position.
1253
+ * console.log(result2);
1254
+ * // Output: 10
1255
+ * // The first occurrence of bit value 1, starting at the last byte in the string stored at `key1`, is at the eleventh position.
1217
1256
  *
1218
1257
  * await client.set("key1", "A12"); // "A12" has binary value 01000001 00110001 00110010
1219
1258
  * const result3 = await client.bitpos("key1", 1, { start: 1, end: -1 });
1220
- * console.log(result3); // Output: 10 - 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.
1259
+ * console.log(result3);
1260
+ * // Output: 10
1261
+ * // 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.
1221
1262
  *
1222
1263
  * const result4 = await client.bitpos("key1", 1, { start: 2, end: 9, indexType: BitmapIndexType.BIT });
1223
- * console.log(result4); // Output: 7 - The first occurrence of bit value 1 in the third to tenth bits of the string stored at "key1" is at the eighth position.
1264
+ * console.log(result4);
1265
+ * // Output: 7
1266
+ * // The first occurrence of bit value 1 in the third to tenth bits of the string stored at `key1` is at the eighth position.
1224
1267
  * ```
1225
1268
  */
1226
1269
  async bitpos(key, bit, options) {
@@ -1254,7 +1297,9 @@ class BaseClient {
1254
1297
  * ```typescript
1255
1298
  * await client.set("key", "A"); // "A" has binary value 01000001
1256
1299
  * const result = await client.bitfield("key", [new BitFieldSet(new UnsignedEncoding(2), new BitOffset(1), 3), new BitFieldGet(new UnsignedEncoding(2), new BitOffset(1))]);
1257
- * console.log(result); // Output: [2, 3] - 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.
1300
+ * console.log(result);
1301
+ * // Output: [2, 3]
1302
+ * // 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.
1258
1303
  * ```
1259
1304
  */
1260
1305
  async bitfield(key, subcommands) {
@@ -1274,7 +1319,9 @@ class BaseClient {
1274
1319
  * ```typescript
1275
1320
  * await client.set("key", "A"); // "A" has binary value 01000001
1276
1321
  * const result = await client.bitfieldReadOnly("key", [new BitFieldGet(new UnsignedEncoding(2), new BitOffset(1))]);
1277
- * console.log(result); // Output: [2] - The value at offset 1 with an unsigned encoding of 2 is 2.
1322
+ * console.log(result);
1323
+ * // Output: [2]
1324
+ * // The value at offset 1 with an unsigned encoding of 2 is 2.
1278
1325
  * ```
1279
1326
  */
1280
1327
  async bitfieldReadOnly(key, subcommands) {
@@ -1294,14 +1341,18 @@ class BaseClient {
1294
1341
  * // Example usage of the hget method on an-existing field
1295
1342
  * await client.hset("my_hash", {"field": "value"});
1296
1343
  * const result = await client.hget("my_hash", "field");
1297
- * console.log(result); // Output: "value"
1344
+ * console.log(result);
1345
+ * // Output: "value"
1346
+ * // The value associated with `field` in the key `my_hash`.
1298
1347
  * ```
1299
1348
  *
1300
1349
  * @example
1301
1350
  * ```typescript
1302
1351
  * // Example usage of the hget method on a non-existing field
1303
1352
  * const result = await client.hget("my_hash", "nonexistent_field");
1304
- * console.log(result); // Output: null
1353
+ * console.log(result);
1354
+ * // Output: null
1355
+ * // Indicates non existent key.
1305
1356
  * ```
1306
1357
  */
1307
1358
  async hget(key, field, options) {
@@ -1319,11 +1370,15 @@ class BaseClient {
1319
1370
  * ```typescript
1320
1371
  * // Example usage of the hset method using HashDataType as input type
1321
1372
  * const result = await client.hset("my_hash", [{"field": "field1", "value": "value1"}, {"field": "field2", "value": "value2"}]);
1322
- * console.log(result); // Output: 2 - Indicates that 2 fields were successfully set in the hash "my_hash".
1373
+ * console.log(result);
1374
+ * // Output: 2
1375
+ * // Indicates that 2 fields were successfully set in the hash `my_hash`.
1323
1376
  *
1324
1377
  * // Example usage of the hset method using Record<string, GlideString> as input
1325
1378
  * const result = await client.hset("my_hash", {"field1": "value", "field2": "value2"});
1326
- * console.log(result); // Output: 2 - Indicates that 2 fields were successfully set in the hash "my_hash".
1379
+ * console.log(result);
1380
+ * // Output: 2
1381
+ * // Indicates that 2 fields were successfully set in the hash `my_hash`.
1327
1382
  * ```
1328
1383
  */
1329
1384
  async hset(key, fieldsAndValues) {
@@ -1343,7 +1398,9 @@ class BaseClient {
1343
1398
  * // Example usage of the hkeys method:
1344
1399
  * await client.hset("my_hash", {"field1": "value1", "field2": "value2", "field3": "value3"});
1345
1400
  * const result = await client.hkeys("my_hash");
1346
- * console.log(result); // Output: ["field1", "field2", "field3"] - Returns all the field names stored in the hash "my_hash".
1401
+ * console.log(result);
1402
+ * // Output: ["field1", "field2", "field3"]
1403
+ * // Returns all the field names stored in the hash `my_hash`.
1347
1404
  * ```
1348
1405
  */
1349
1406
  async hkeys(key, options) {
@@ -1364,14 +1421,18 @@ class BaseClient {
1364
1421
  * ```typescript
1365
1422
  * // Example usage of the hsetnx method
1366
1423
  * const result = await client.hsetnx("my_hash", "field", "value");
1367
- * console.log(result); // Output: true - Indicates that the field "field" was set successfully in the hash "my_hash".
1424
+ * console.log(result);
1425
+ * // Output: true
1426
+ * // Indicates that the field "field" was set successfully in the hash `my_hash`.
1368
1427
  * ```
1369
1428
  *
1370
1429
  * @example
1371
1430
  * ```typescript
1372
1431
  * // Example usage of the hsetnx method on a field that already exists
1373
1432
  * const result = await client.hsetnx("my_hash", "field", "new_value");
1374
- * console.log(result); // Output: false - Indicates that the field "field" already existed in the hash "my_hash" and was not set again.
1433
+ * console.log(result);
1434
+ * // Output: false
1435
+ * // Indicates that the field `field` already existed in the hash `my_hash` and was not set again.
1375
1436
  * ```
1376
1437
  */
1377
1438
  async hsetnx(key, field, value) {
@@ -1391,7 +1452,9 @@ class BaseClient {
1391
1452
  * ```typescript
1392
1453
  * // Example usage of the hdel method
1393
1454
  * const result = await client.hdel("my_hash", ["field1", "field2"]);
1394
- * console.log(result); // Output: 2 - Indicates that two fields were successfully removed from the hash.
1455
+ * console.log(result);
1456
+ * // Output: 2
1457
+ * // Indicates that two fields were successfully removed from the hash.
1395
1458
  * ```
1396
1459
  */
1397
1460
  async hdel(key, fields) {
@@ -1412,7 +1475,9 @@ class BaseClient {
1412
1475
  * ```typescript
1413
1476
  * // Example usage of the hmget method
1414
1477
  * const result = await client.hmget("my_hash", ["field1", "field2"]);
1415
- * console.log(result); // Output: ["value1", "value2"] - A list of values associated with the specified fields.
1478
+ * console.log(result);
1479
+ * // Output: ["value1", "value2"]
1480
+ * // A list of values associated with the specified fields.
1416
1481
  * ```
1417
1482
  */
1418
1483
  async hmget(key, fields, options) {
@@ -1430,14 +1495,18 @@ class BaseClient {
1430
1495
  * ```typescript
1431
1496
  * // Example usage of the hexists method with existing field
1432
1497
  * const result = await client.hexists("my_hash", "field1");
1433
- * console.log(result); // Output: true
1498
+ * console.log(result);
1499
+ * // Output: true
1500
+ * // Returns true because `my_hash` hash contains `field1` field.
1434
1501
  * ```
1435
1502
  *
1436
1503
  * @example
1437
1504
  * ```typescript
1438
1505
  * // Example usage of the hexists method with non-existing field
1439
1506
  * const result = await client.hexists("my_hash", "nonexistent_field");
1440
- * console.log(result); // Output: false
1507
+ * console.log(result);
1508
+ * // Output: false
1509
+ * // Returns false because `my_hash` hash does not contain `nonexistent_field` field.
1441
1510
  * ```
1442
1511
  */
1443
1512
  async hexists(key, field) {
@@ -1457,7 +1526,8 @@ class BaseClient {
1457
1526
  * ```typescript
1458
1527
  * // Example usage of the hgetall method
1459
1528
  * const result = await client.hgetall("my_hash");
1460
- * console.log(result); // Output:
1529
+ * console.log(result);
1530
+ * // Output: all fields and values stored at `my_hash`
1461
1531
  * // [
1462
1532
  * // { field: "field1", value: "value1"},
1463
1533
  * // { field: "field2", value: "value2"}
@@ -1484,7 +1554,9 @@ class BaseClient {
1484
1554
  * ```typescript
1485
1555
  * // Example usage of the hincrby method to increment the value in a hash by a specified amount
1486
1556
  * const result = await client.hincrby("my_hash", "field1", 5);
1487
- * console.log(result); // Output: 5
1557
+ * console.log(result);
1558
+ * // Output: 5
1559
+ * // Increments the value stored at hash field `field1` by 5
1488
1560
  * ```
1489
1561
  */
1490
1562
  async hincrBy(key, field, amount) {
@@ -1505,7 +1577,9 @@ class BaseClient {
1505
1577
  * ```typescript
1506
1578
  * // Example usage of the hincrbyfloat method to increment the value of a floating point in a hash by a specified amount
1507
1579
  * const result = await client.hincrbyfloat("my_hash", "field1", 2.5);
1508
- * console.log(result); // Output: 2.5
1580
+ * console.log(result);
1581
+ * // Output: 2.5
1582
+ * // Increments the value stored at hash field `field1` by 2.5
1509
1583
  * ```
1510
1584
  */
1511
1585
  async hincrByFloat(key, field, amount) {
@@ -1522,14 +1596,18 @@ class BaseClient {
1522
1596
  * ```typescript
1523
1597
  * // Example usage of the hlen method with an existing key
1524
1598
  * const result = await client.hlen("my_hash");
1525
- * console.log(result); // Output: 3
1599
+ * console.log(result);
1600
+ * // Output: 3
1601
+ * // Returns the number of fields for the hash stored at key `my_hash`.
1526
1602
  * ```
1527
1603
  *
1528
1604
  * @example
1529
1605
  * ```typescript
1530
1606
  * // Example usage of the hlen method with a non-existing key
1531
1607
  * const result = await client.hlen("non_existing_key");
1532
- * console.log(result); // Output: 0
1608
+ * console.log(result);
1609
+ * // Output: 0
1610
+ * // Returns 0 for non-existent key.
1533
1611
  * ```
1534
1612
  */
1535
1613
  async hlen(key) {
@@ -1547,7 +1625,9 @@ class BaseClient {
1547
1625
  * ```typescript
1548
1626
  * // Example usage of the hvals method
1549
1627
  * const result = await client.hvals("my_hash");
1550
- * console.log(result); // Output: ["value1", "value2", "value3"] - Returns all the values stored in the hash "my_hash".
1628
+ * console.log(result);
1629
+ * // Output: ["value1", "value2", "value3"]
1630
+ * // Returns all the values stored in the hash `my_hash`.
1551
1631
  * ```
1552
1632
  */
1553
1633
  async hvals(key, options) {
@@ -1566,7 +1646,9 @@ class BaseClient {
1566
1646
  * ```typescript
1567
1647
  * await client.hset("my_hash", {"field": "value"});
1568
1648
  * const result = await client.hstrlen("my_hash", "field");
1569
- * console.log(result); // Output: 5
1649
+ * console.log(result);
1650
+ * // Output: 5
1651
+ * // Returns the string length of `value` which is the value associated with the field `field` stored at key `my_hash`.
1570
1652
  * ```
1571
1653
  */
1572
1654
  async hstrlen(key, field) {
@@ -1585,7 +1667,10 @@ class BaseClient {
1585
1667
  *
1586
1668
  * @example
1587
1669
  * ```typescript
1588
- * console.log(await client.hrandfield("myHash")); // Output: 'field'
1670
+ * const result = await client.hrandfield("myHash")
1671
+ * console.log(result);
1672
+ * // Output: 'field'
1673
+ * // Returns a random field stored at the key `my_hash`.
1589
1674
  * ```
1590
1675
  */
1591
1676
  async hrandfield(key, options) {
@@ -1621,12 +1706,13 @@ class BaseClient {
1621
1706
  * console.log("Members: ", result[1]);
1622
1707
  * } while (newCursor !== "0");
1623
1708
  * // The output of the code above is something similar to:
1624
- * // Cursor: 31
1625
- * // Members: ['field 79', 'value 79', 'field 20', 'value 20', 'field 115', 'value 115']
1626
- * // Cursor: 39
1627
- * // Members: ['field 63', 'value 63', 'field 293', 'value 293', 'field 162', 'value 162']
1628
- * // Cursor: 0
1709
+ * // Cursor: 31 // The cursor after the first interation.
1710
+ * // Members: ['field 79', 'value 79', 'field 20', 'value 20', 'field 115', 'value 115'] // First 3 hash field-value pairs stored at the key `key1`
1711
+ * // Cursor: 39 // The cursor after the second interation.
1712
+ * // Members: ['field 63', 'value 63', 'field 293', 'value 293', 'field 162', 'value 162'] // The next 3 hash field-value pairs at key `key1`
1713
+ * // Cursor: 0 // The cursor after the last batch of elements is fetched.
1629
1714
  * // Members: ['field 55', 'value 55', 'field 24', 'value 24', 'field 90', 'value 90', 'field 113', 'value 113']
1715
+ * // You can get more than `count` elements in the result set. Read the count documentation for more information.
1630
1716
  * ```
1631
1717
  * @example
1632
1718
  * ```typescript
@@ -1644,12 +1730,13 @@ class BaseClient {
1644
1730
  * console.log("Members: ", result[1]);
1645
1731
  * } while (newCursor !== "0");
1646
1732
  * // The output of the code above is something similar to:
1647
- * // Cursor: 31
1648
- * // Members: ['field 79', 'field 20', 'field 115']
1649
- * // Cursor: 39
1650
- * // Members: ['field 63', 'field 293', 'field 162']
1651
- * // Cursor: 0
1733
+ * // Cursor: 31 // The cursor after the first interation.
1734
+ * // Members: ['field 79', 'field 20', 'field 115'] // First 3 hash fields stored at the key `key1`
1735
+ * // Cursor: 39 // The cursor after the second interation.
1736
+ * // Members: ['field 63', 'field 293', 'field 162'] // Next 3 hash fields stored at the key `key1`
1737
+ * // Cursor: 0 // The cursor after the last batch of elements is fetched.
1652
1738
  * // Members: ['field 55', 'field 24', 'field 90', 'field 113']
1739
+ * // You can get more than `count` elements in the result set. Read the count documentation for more information.
1653
1740
  * ```
1654
1741
  */
1655
1742
  async hscan(key, cursor, options) {
@@ -1671,7 +1758,10 @@ class BaseClient {
1671
1758
  *
1672
1759
  * @example
1673
1760
  * ```typescript
1674
- * console.log(await client.hrandfieldCount("myHash", 2)); // Output: ['field1', 'field2']
1761
+ * result = await client.hrandfieldCount("my_hash", 2)
1762
+ * console.log(result);
1763
+ * // Output: ['field1', 'field2']
1764
+ * // Returns 2 random fields from the hash stored at key `my_hash`.
1675
1765
  * ```
1676
1766
  */
1677
1767
  async hrandfieldCount(key, count, options) {
@@ -1696,7 +1786,9 @@ class BaseClient {
1696
1786
  * @example
1697
1787
  * ```typescript
1698
1788
  * const result = await client.hrandfieldCountWithValues("myHash", 2);
1699
- * console.log(result); // Output: [['field1', 'value1'], ['field2', 'value2']]
1789
+ * console.log(result);
1790
+ * // Output: [['field1', 'value1'], ['field2', 'value2']]
1791
+ * // Returns 2 random field-value pairs from the hash stored at key `my_hash`.
1700
1792
  * ```
1701
1793
  */
1702
1794
  async hrandfieldWithValues(key, count, options) {
@@ -1716,14 +1808,18 @@ class BaseClient {
1716
1808
  * ```typescript
1717
1809
  * // Example usage of the lpush method with an existing list
1718
1810
  * const result = await client.lpush("my_list", ["value2", "value3"]);
1719
- * console.log(result); // Output: 3 - Indicated that the new length of the list is 3 after the push operation.
1811
+ * console.log(result);
1812
+ * // Output: 3
1813
+ * // Indicates that the new length of the list is 3 after the push operation.
1720
1814
  * ```
1721
1815
  *
1722
1816
  * @example
1723
1817
  * ```typescript
1724
1818
  * // Example usage of the lpush method with a non-existing list
1725
1819
  * const result = await client.lpush("nonexistent_list", ["new_value"]);
1726
- * console.log(result); // Output: 1 - Indicates that a new list was created with one element
1820
+ * console.log(result);
1821
+ * // Output: 1
1822
+ * // Indicates that a new list was created with one element
1727
1823
  * ```
1728
1824
  */
1729
1825
  async lpush(key, elements) {
@@ -1740,8 +1836,10 @@ class BaseClient {
1740
1836
  * @returns The length of the list after the push operation.
1741
1837
  * @example
1742
1838
  * ```typescript
1743
- * const listLength = await client.lpushx("my_list", ["value1", "value2"]);
1744
- * console.log(result); // Output: 2 - Indicates that the list has two elements.
1839
+ * const result = await client.lpushx("my_list", ["value1", "value2"]);
1840
+ * console.log(result);
1841
+ * // Output: 2
1842
+ * // Indicates that the list has two elements after the push operation.
1745
1843
  * ```
1746
1844
  */
1747
1845
  async lpushx(key, elements) {
@@ -1761,14 +1859,18 @@ class BaseClient {
1761
1859
  * ```typescript
1762
1860
  * // Example usage of the lpop method with an existing list
1763
1861
  * const result = await client.lpop("my_list");
1764
- * console.log(result); // Output: 'value1'
1862
+ * console.log(result);
1863
+ * // Output: 'value1'
1864
+ * // Returns and removes the first element of the list `value1`.
1765
1865
  * ```
1766
1866
  *
1767
1867
  * @example
1768
1868
  * ```typescript
1769
1869
  * // Example usage of the lpop method with a non-existing list
1770
1870
  * const result = await client.lpop("non_exiting_key");
1771
- * console.log(result); // Output: null
1871
+ * console.log(result);
1872
+ * // Output: null
1873
+ * // Returns null for non-existent key.
1772
1874
  * ```
1773
1875
  */
1774
1876
  async lpop(key, options) {
@@ -1788,14 +1890,18 @@ class BaseClient {
1788
1890
  * ```typescript
1789
1891
  * // Example usage of the lpopCount method with an existing list
1790
1892
  * const result = await client.lpopCount("my_list", 2);
1791
- * console.log(result); // Output: ["value1", "value2"]
1893
+ * console.log(result);
1894
+ * // Output: ["value1", "value2"]
1895
+ * // Returns and removes 2 elements from the list.
1792
1896
  * ```
1793
1897
  *
1794
1898
  * @example
1795
1899
  * ```typescript
1796
1900
  * // Example usage of the lpopCount method with a non-existing list
1797
1901
  * const result = await client.lpopCount("non_exiting_key", 3);
1798
- * console.log(result); // Output: null
1902
+ * console.log(result);
1903
+ * // Output: null
1904
+ * // Returns null in case of non-existent key.
1799
1905
  * ```
1800
1906
  */
1801
1907
  async lpopCount(key, count, options) {
@@ -1821,21 +1927,27 @@ class BaseClient {
1821
1927
  * ```typescript
1822
1928
  * // Example usage of the lrange method with an existing list and positive indices
1823
1929
  * const result = await client.lrange("my_list", 0, 2);
1824
- * console.log(result); // Output: ["value1", "value2", "value3"]
1930
+ * console.log(result);
1931
+ * // Output: ["value1", "value2", "value3"]
1932
+ * // Returns the first 3 elements of the list.
1825
1933
  * ```
1826
1934
  *
1827
1935
  * @example
1828
1936
  * ```typescript
1829
1937
  * // Example usage of the lrange method with an existing list and negative indices
1830
1938
  * const result = await client.lrange("my_list", -2, -1);
1831
- * console.log(result); // Output: ["value2", "value3"]
1939
+ * console.log(result);
1940
+ * // Output: ["value2", "value3"]
1941
+ * // Returns the last 2 elements of the list.
1832
1942
  * ```
1833
1943
  *
1834
1944
  * @example
1835
1945
  * ```typescript
1836
1946
  * // Example usage of the lrange method with a non-existing list
1837
1947
  * const result = await client.lrange("non_exiting_key", 0, 2);
1838
- * console.log(result); // Output: []
1948
+ * console.log(result);
1949
+ * // Output: []
1950
+ * // Returns an empty list for non-existent key.
1839
1951
  * ```
1840
1952
  */
1841
1953
  async lrange(key, start, end, options) {
@@ -1853,7 +1965,9 @@ class BaseClient {
1853
1965
  * ```typescript
1854
1966
  * // Example usage of the llen method
1855
1967
  * const result = await client.llen("my_list");
1856
- * console.log(result); // Output: 3 - Indicates that there are 3 elements in the list.
1968
+ * console.log(result);
1969
+ * // Output: 3
1970
+ * // Indicates that there are 3 elements in the list.
1857
1971
  * ```
1858
1972
  */
1859
1973
  async llen(key) {
@@ -1876,17 +1990,23 @@ class BaseClient {
1876
1990
  *
1877
1991
  * @example
1878
1992
  * ```typescript
1879
- * await client.lpush("testKey1", ["two", "one"]);
1880
- * await client.lpush("testKey2", ["four", "three"]);
1993
+ * await client.lpush("testKey1", ["two", "one"]); // The key `testKey1` has a list ["one", "two"] after this operation.
1994
+ * await client.lpush("testKey2", ["four", "three"]); // The key `testKey2` has a list ["three", "four"] after this operation.
1881
1995
  *
1882
- * const result1 = await client.lmove("testKey1", "testKey2", ListDirection.LEFT, ListDirection.LEFT);
1883
- * console.log(result1); // Output: "one".
1996
+ * const result = await client.lmove("testKey1", "testKey2", ListDirection.LEFT, ListDirection.LEFT);
1997
+ * console.log(result);
1998
+ * // Output: "one".
1999
+ * // Removes "one" from the list at key `testKey1` and adds it to the left of the list at `testKey2`.
1884
2000
  *
1885
2001
  * const updated_array_key1 = await client.lrange("testKey1", 0, -1);
1886
- * console.log(updated_array); // Output: "two".
2002
+ * console.log(updated_array_key1);
2003
+ * // Output: ["two"]
2004
+ * // The elements in the list at `testKey1` after lmove command.
1887
2005
  *
1888
2006
  * const updated_array_key2 = await client.lrange("testKey2", 0, -1);
1889
- * console.log(updated_array_key2); // Output: ["one", "three", "four"].
2007
+ * console.log(updated_array_key2);
2008
+ * // Output: ["one", "three", "four"]
2009
+ * // The elements in the list at `testKey2` after lmove command.
1890
2010
  * ```
1891
2011
  */
1892
2012
  async lmove(source, destination, whereFrom, whereTo, options) {
@@ -1913,16 +2033,22 @@ class BaseClient {
1913
2033
  *
1914
2034
  * @example
1915
2035
  * ```typescript
1916
- * await client.lpush("testKey1", ["two", "one"]);
1917
- * await client.lpush("testKey2", ["four", "three"]);
2036
+ * await client.lpush("testKey1", ["two", "one"]); // The key `testKey1` has a list ["one", "two"] after this operation.
2037
+ * await client.lpush("testKey2", ["four", "three"]); // The key `testKey2` has a list ["three", "four"] after this operation.
1918
2038
  * const result = await client.blmove("testKey1", "testKey2", ListDirection.LEFT, ListDirection.LEFT, 0.1);
1919
- * console.log(result); // Output: "one"
2039
+ * console.log(result);
2040
+ * // Output: "one"
2041
+ * // Removes "one" from the list at key `testKey1` and adds it to the left of the list at `testKey2`.
1920
2042
  *
1921
- * const result2 = await client.lrange("testKey1", 0, -1);
1922
- * console.log(result2); // Output: "two"
2043
+ * const updated_array1 = await client.lrange("testKey1", 0, -1);
2044
+ * console.log(updated_array1);
2045
+ * // Output: "two"
2046
+ * // The elements in the list at `testKey1` after blmove command.
1923
2047
  *
1924
2048
  * const updated_array2 = await client.lrange("testKey2", 0, -1);
1925
- * console.log(updated_array2); // Output: ["one", "three", "four"]
2049
+ * console.log(updated_array2);
2050
+ * // Output: ["one", "three", "four"]
2051
+ * // The elements in the list at `testKey2` after blmove command.
1926
2052
  * ```
1927
2053
  */
1928
2054
  async blmove(source, destination, whereFrom, whereTo, timeout, options) {
@@ -1944,8 +2070,10 @@ class BaseClient {
1944
2070
  * @example
1945
2071
  * ```typescript
1946
2072
  * // Example usage of the lset method
1947
- * const response = await client.lset("test_key", 1, "two");
1948
- * console.log(response); // Output: 'OK' - Indicates that the second index of the list has been set to "two".
2073
+ * const result = await client.lset("test_key", 1, "two");
2074
+ * console.log(result);
2075
+ * // Output: 'OK'
2076
+ * // Indicates that the second index of the list has been set to "two".
1949
2077
  * ```
1950
2078
  */
1951
2079
  async lset(key, index, element) {
@@ -1964,7 +2092,7 @@ class BaseClient {
1964
2092
  * @param start - The starting point of the range.
1965
2093
  * @param end - The end of the range.
1966
2094
  * @returns always "OK".
1967
- * If `start` exceeds the end of the list, or if `start` is greater than `end`, the result will be an empty list (which causes key to be removed).
2095
+ * If `start` exceeds the end of the list, or if `start` is greater than `end`, the list is emptied and the key is removed.
1968
2096
  * If `end` exceeds the actual end of the list, it will be treated like the last element of the list.
1969
2097
  * If `key` does not exist the command will be ignored.
1970
2098
  *
@@ -1972,7 +2100,9 @@ class BaseClient {
1972
2100
  * ```typescript
1973
2101
  * // Example usage of the ltrim method
1974
2102
  * const result = await client.ltrim("my_list", 0, 1);
1975
- * console.log(result); // Output: 'OK' - Indicates that the list has been trimmed to contain elements from 0 to 1.
2103
+ * console.log(result);
2104
+ * // Output: 'OK'
2105
+ * // Indicates that the list has been trimmed to contain elements from 0 to 1.
1976
2106
  * ```
1977
2107
  */
1978
2108
  async ltrim(key, start, end) {
@@ -1981,12 +2111,12 @@ class BaseClient {
1981
2111
  });
1982
2112
  }
1983
2113
  /** Removes the first `count` occurrences of elements equal to `element` from the list stored at `key`.
1984
- * If `count` is positive : Removes elements equal to `element` moving from head to tail.
1985
- * If `count` is negative : Removes elements equal to `element` moving from tail to head.
1986
- * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
1987
2114
  *
1988
2115
  * @param key - The key of the list.
1989
2116
  * @param count - The count of the occurrences of elements equal to `element` to remove.
2117
+ * If `count` is positive : Removes elements equal to `element` moving from head to tail.
2118
+ * If `count` is negative : Removes elements equal to `element` moving from tail to head.
2119
+ * If `count` is 0 or `count` is greater than the occurrences of elements equal to `element`: Removes all elements equal to `element`.
1990
2120
  * @param element - The element to remove from the list.
1991
2121
  * @returns the number of the removed elements.
1992
2122
  * If `key` does not exist, 0 is returned.
@@ -1995,7 +2125,9 @@ class BaseClient {
1995
2125
  * ```typescript
1996
2126
  * // Example usage of the lrem method
1997
2127
  * const result = await client.lrem("my_list", 2, "value");
1998
- * console.log(result); // Output: 2 - Removes the first 2 occurrences of "value" in the list.
2128
+ * console.log(result);
2129
+ * // Output: 2
2130
+ * // Removes the first 2 occurrences of "value" in the list.
1999
2131
  * ```
2000
2132
  */
2001
2133
  async lrem(key, count, element) {
@@ -2015,14 +2147,17 @@ class BaseClient {
2015
2147
  * ```typescript
2016
2148
  * // Example usage of the rpush method with an existing list
2017
2149
  * const result = await client.rpush("my_list", ["value2", "value3"]);
2018
- * console.log(result); // Output: 3 - Indicates that the new length of the list is 3 after the push operation.
2150
+ * console.log(result);
2151
+ * // Output: 3
2152
+ * // Indicates that the new length of the list is 3 after the push operation.
2019
2153
  * ```
2020
2154
  *
2021
2155
  * @example
2022
2156
  * ```typescript
2023
2157
  * // Example usage of the rpush method with a non-existing list
2024
2158
  * const result = await client.rpush("nonexistent_list", ["new_value"]);
2025
- * console.log(result); // Output: 1
2159
+ * console.log(result);
2160
+ * // Output: 1
2026
2161
  * ```
2027
2162
  */
2028
2163
  async rpush(key, elements) {
@@ -2040,7 +2175,9 @@ class BaseClient {
2040
2175
  * @example
2041
2176
  * ```typescript
2042
2177
  * const result = await client.rpushx("my_list", ["value1", "value2"]);
2043
- * console.log(result); // Output: 2 - Indicates that the list has two elements.
2178
+ * console.log(result);
2179
+ * // Output: 2
2180
+ * // Indicates that the list has two elements.
2044
2181
  * ```
2045
2182
  * */
2046
2183
  async rpushx(key, elements) {
@@ -2060,14 +2197,18 @@ class BaseClient {
2060
2197
  * ```typescript
2061
2198
  * // Example usage of the rpop method with an existing list
2062
2199
  * const result = await client.rpop("my_list");
2063
- * console.log(result); // Output: 'value1'
2200
+ * console.log(result);
2201
+ * // Output: 'value1'
2202
+ * // Returns and removes the last element of the list stored at `my_list`.
2064
2203
  * ```
2065
2204
  *
2066
2205
  * @example
2067
2206
  * ```typescript
2068
2207
  * // Example usage of the rpop method with a non-existing list
2069
2208
  * const result = await client.rpop("non_exiting_key");
2070
- * console.log(result); // Output: null
2209
+ * console.log(result);
2210
+ * // Output: null
2211
+ * // Returns null for non-existent key.
2071
2212
  * ```
2072
2213
  */
2073
2214
  async rpop(key, options) {
@@ -2087,14 +2228,18 @@ class BaseClient {
2087
2228
  * ```typescript
2088
2229
  * // Example usage of the rpopCount method with an existing list
2089
2230
  * const result = await client.rpopCount("my_list", 2);
2090
- * console.log(result); // Output: ["value1", "value2"]
2231
+ * console.log(result);
2232
+ * // Output: ["value1", "value2"]
2233
+ * // Returns and removes the last 2 elements from the list stored at `my_list`.
2091
2234
  * ```
2092
2235
  *
2093
2236
  * @example
2094
2237
  * ```typescript
2095
2238
  * // Example usage of the rpopCount method with a non-existing list
2096
2239
  * const result = await client.rpopCount("non_exiting_key", 7);
2097
- * console.log(result); // Output: null
2240
+ * console.log(result);
2241
+ * // Output: null
2242
+ * // Returns null for a non-existing key.
2098
2243
  * ```
2099
2244
  */
2100
2245
  async rpopCount(key, count, options) {
@@ -2113,7 +2258,9 @@ class BaseClient {
2113
2258
  * ```typescript
2114
2259
  * // Example usage of the sadd method with an existing set
2115
2260
  * const result = await client.sadd("my_set", ["member1", "member2"]);
2116
- * console.log(result); // Output: 2
2261
+ * console.log(result);
2262
+ * // Output: 2
2263
+ * // Adds 2 members to the set at key `my_set`
2117
2264
  * ```
2118
2265
  */
2119
2266
  async sadd(key, members) {
@@ -2132,7 +2279,9 @@ class BaseClient {
2132
2279
  * ```typescript
2133
2280
  * // Example usage of the srem method
2134
2281
  * const result = await client.srem("my_set", ["member1", "member2"]);
2135
- * console.log(result); // Output: 2
2282
+ * console.log(result);
2283
+ * // Output: 2
2284
+ * // Removes `member1` and `member2` from the set at key `my_set`.
2136
2285
  * ```
2137
2286
  */
2138
2287
  async srem(key, members) {
@@ -2190,7 +2339,8 @@ class BaseClient {
2190
2339
  * ```typescript
2191
2340
  * // Example usage of the smembers method
2192
2341
  * const result = await client.smembers("my_set");
2193
- * console.log(result); // Output: Set {'member1', 'member2', 'member3'}
2342
+ * console.log(result);
2343
+ * // Output: Set(3) {'member1', 'member2', 'member3'}
2194
2344
  * ```
2195
2345
  */
2196
2346
  async smembers(key, options) {
@@ -2210,7 +2360,9 @@ class BaseClient {
2210
2360
  * @example
2211
2361
  * ```typescript
2212
2362
  * const result = await client.smove("set1", "set2", "member1");
2213
- * console.log(result); // Output: true - "member1" was moved from "set1" to "set2".
2363
+ * console.log(result);
2364
+ * // Output: true
2365
+ * // `member1` was moved from `set1` to `set2`.
2214
2366
  * ```
2215
2367
  */
2216
2368
  async smove(source, destination, member) {
@@ -2227,7 +2379,8 @@ class BaseClient {
2227
2379
  * ```typescript
2228
2380
  * // Example usage of the scard method
2229
2381
  * const result = await client.scard("my_set");
2230
- * console.log(result); // Output: 3
2382
+ * console.log(result);
2383
+ * // Output: 3
2231
2384
  * ```
2232
2385
  */
2233
2386
  async scard(key) {
@@ -2247,14 +2400,18 @@ class BaseClient {
2247
2400
  * ```typescript
2248
2401
  * // Example usage of sinter method when member exists
2249
2402
  * const result = await client.sinter(["my_set1", "my_set2"]);
2250
- * console.log(result); // Output: Set {'member2'} - Indicates that sets have one common member
2403
+ * console.log(result);
2404
+ * // Output: Set(1) {'member2'}
2405
+ * // Indicates that sets have one common member
2251
2406
  * ```
2252
2407
  *
2253
2408
  * @example
2254
2409
  * ```typescript
2255
2410
  * // Example usage of sinter method with non-existing key
2256
2411
  * const result = await client.sinter(["my_set", "non_existing_key"]);
2257
- * console.log(result); // Output: Set {} - An empty set is returned since the key does not exist.
2412
+ * console.log(result);
2413
+ * // Output: Set(0) {}
2414
+ * // An empty set is returned since the key does not exist.
2258
2415
  * ```
2259
2416
  */
2260
2417
  async sinter(keys, options) {
@@ -2277,10 +2434,14 @@ class BaseClient {
2277
2434
  * await client.sadd("set1", ["a", "b", "c"]);
2278
2435
  * await client.sadd("set2", ["b", "c", "d"]);
2279
2436
  * const result1 = await client.sintercard(["set1", "set2"]);
2280
- * console.log(result1); // Output: 2 - The intersection of "set1" and "set2" contains 2 elements: "b" and "c".
2437
+ * console.log(result1);
2438
+ * // Output: 2
2439
+ * // The intersection of `set1` and `set2` contains 2 elements: `b` and `c`.
2281
2440
  *
2282
2441
  * const result2 = await client.sintercard(["set1", "set2"], { limit: 1 });
2283
- * console.log(result2); // Output: 1 - The computation stops early as the intersection cardinality reaches the limit of 1.
2442
+ * console.log(result2);
2443
+ * // Output: 1
2444
+ * // The computation stops early as the intersection cardinality reaches the limit of 1.
2284
2445
  * ```
2285
2446
  */
2286
2447
  async sintercard(keys, options) {
@@ -2299,7 +2460,9 @@ class BaseClient {
2299
2460
  * @example
2300
2461
  * ```typescript
2301
2462
  * const result = await client.sinterstore("my_set", ["set1", "set2"]);
2302
- * console.log(result); // Output: 2 - Two elements were stored at "my_set", and those elements are the intersection of "set1" and "set2".
2463
+ * console.log(result);
2464
+ * // Output: 2
2465
+ * // Two elements were stored at `my_set`, and those elements are the intersection of `set1` and `set2`.
2303
2466
  * ```
2304
2467
  */
2305
2468
  async sinterstore(destination, keys) {
@@ -2321,7 +2484,9 @@ class BaseClient {
2321
2484
  * await client.sadd("set1", ["member1", "member2"]);
2322
2485
  * await client.sadd("set2", ["member1"]);
2323
2486
  * const result = await client.sdiff(["set1", "set2"]);
2324
- * console.log(result); // Output: Set {"member1"} - "member2" is in "set1" but not "set2"
2487
+ * console.log(result);
2488
+ * // Output: Set(1) {"member1"}
2489
+ * // `member2` is in `set1` but not `set2`
2325
2490
  * ```
2326
2491
  */
2327
2492
  async sdiff(keys, options) {
@@ -2342,7 +2507,9 @@ class BaseClient {
2342
2507
  * await client.sadd("set1", ["member1", "member2"]);
2343
2508
  * await client.sadd("set2", ["member1"]);
2344
2509
  * const result = await client.sdiffstore("set3", ["set1", "set2"]);
2345
- * console.log(result); // Output: 1 - One member was stored in "set3", and that member is the diff between "set1" and "set2".
2510
+ * console.log(result);
2511
+ * // Output: 1
2512
+ * // One member was stored in `set3`, and that member is the diff between `set1` and `set2`.
2346
2513
  * ```
2347
2514
  */
2348
2515
  async sdiffstore(destination, keys) {
@@ -2364,10 +2531,13 @@ class BaseClient {
2364
2531
  * await client.sadd("my_set1", ["member1", "member2"]);
2365
2532
  * await client.sadd("my_set2", ["member2", "member3"]);
2366
2533
  * const result1 = await client.sunion(["my_set1", "my_set2"]);
2367
- * console.log(result1); // Output: Set {'member1', 'member2', 'member3'} - Sets "my_set1" and "my_set2" have three unique members.
2534
+ * console.log(result1);
2535
+ * // Output: Set(3) {'member1', 'member2', 'member3'}
2536
+ * // Sets `my_set1` and `my_set2` have three unique members.
2368
2537
  *
2369
2538
  * const result2 = await client.sunion(["my_set1", "non_existing_set"]);
2370
- * console.log(result2); // Output: Set {'member1', 'member2'}
2539
+ * console.log(result2);
2540
+ * // Output: Set(2) {'member1', 'member2'}
2371
2541
  * ```
2372
2542
  */
2373
2543
  async sunion(keys, options) {
@@ -2387,7 +2557,9 @@ class BaseClient {
2387
2557
  * @example
2388
2558
  * ```typescript
2389
2559
  * const length = await client.sunionstore("mySet", ["set1", "set2"]);
2390
- * console.log(length); // Output: 2 - Two elements were stored in "mySet", and those two members are the union of "set1" and "set2".
2560
+ * console.log(length);
2561
+ * // Output: 2
2562
+ * // Two elements were stored in `mySet`, and those two members are the union of `set1` and `set2`.
2391
2563
  * ```
2392
2564
  */
2393
2565
  async sunionstore(destination, keys) {
@@ -2406,14 +2578,18 @@ class BaseClient {
2406
2578
  * ```typescript
2407
2579
  * // Example usage of the sismember method when member exists
2408
2580
  * const result = await client.sismember("my_set", "member1");
2409
- * console.log(result); // Output: true - Indicates that "member1" exists in the set "my_set".
2581
+ * console.log(result);
2582
+ * // Output: true
2583
+ * // Indicates that `member1` exists in the set `my_set`.
2410
2584
  * ```
2411
2585
  *
2412
2586
  * @example
2413
2587
  * ```typescript
2414
2588
  * // Example usage of the sismember method when member does not exist
2415
2589
  * const result = await client.sismember("my_set", "non_existing_member");
2416
- * console.log(result); // Output: false - Indicates that "non_existing_member" does not exist in the set "my_set".
2590
+ * console.log(result);
2591
+ * // Output: false
2592
+ * // Indicates that `non_existing_member` does not exist in the set `my_set`.
2417
2593
  * ```
2418
2594
  */
2419
2595
  async sismember(key, member) {
@@ -2433,7 +2609,9 @@ class BaseClient {
2433
2609
  * ```typescript
2434
2610
  * await client.sadd("set1", ["a", "b", "c"]);
2435
2611
  * const result = await client.smismember("set1", ["b", "c", "d"]);
2436
- * console.log(result); // Output: [true, true, false] - "b" and "c" are members of "set1", but "d" is not.
2612
+ * console.log(result);
2613
+ * // Output: [true, true, false]
2614
+ * // `b` and `c` are members of `set1`, but `d` is not.
2437
2615
  * ```
2438
2616
  */
2439
2617
  async smismember(key, members) {
@@ -2453,14 +2631,17 @@ class BaseClient {
2453
2631
  * ```typescript
2454
2632
  * // Example usage of spop method to remove and return a random member from a set
2455
2633
  * const result = await client.spop("my_set");
2456
- * console.log(result); // Output: 'member1' - Removes and returns a random member from the set "my_set".
2634
+ * console.log(result);
2635
+ * // Output: 'member1'
2636
+ * // Removes and returns a random member from the set `my_set`.
2457
2637
  * ```
2458
2638
  *
2459
2639
  * @example
2460
2640
  * ```typescript
2461
2641
  * // Example usage of spop method with non-existing key
2462
2642
  * const result = await client.spop("non_existing_key");
2463
- * console.log(result); // Output: null
2643
+ * console.log(result);
2644
+ * // Output: null
2464
2645
  * ```
2465
2646
  */
2466
2647
  async spop(key, options) {
@@ -2480,14 +2661,18 @@ class BaseClient {
2480
2661
  * ```typescript
2481
2662
  * // Example usage of spopCount method to remove and return multiple random members from a set
2482
2663
  * const result = await client.spopCount("my_set", 2);
2483
- * console.log(result); // Output: Set {'member2', 'member3'} - Removes and returns 2 random members from the set "my_set".
2664
+ * console.log(result);
2665
+ * // Output: Set(2) {'member2', 'member3'}
2666
+ * // Removes and returns 2 random members from the set `my_set`.
2484
2667
  * ```
2485
2668
  *
2486
2669
  * @example
2487
2670
  * ```typescript
2488
2671
  * // Example usage of spopCount method with non-existing key
2489
2672
  * const result = await client.spopCount("non_existing_key");
2490
- * console.log(result); // Output: Set {} - An empty set is returned since the key does not exist.
2673
+ * console.log(result);
2674
+ * // Output: Set(0) {}
2675
+ * // An empty set is returned since the key does not exist.
2491
2676
  * ```
2492
2677
  */
2493
2678
  async spopCount(key, count, options) {
@@ -2506,14 +2691,17 @@ class BaseClient {
2506
2691
  * ```typescript
2507
2692
  * // Example usage of srandmember method to return a random member from a set
2508
2693
  * const result = await client.srandmember("my_set");
2509
- * console.log(result); // Output: 'member1' - A random member of "my_set".
2694
+ * console.log(result);
2695
+ * // Output: 'member1'
2696
+ * // A random member of `my_set`.
2510
2697
  * ```
2511
2698
  *
2512
2699
  * @example
2513
2700
  * ```typescript
2514
2701
  * // Example usage of srandmember method with non-existing key
2515
2702
  * const result = await client.srandmember("non_existing_set");
2516
- * console.log(result); // Output: null
2703
+ * console.log(result);
2704
+ * // Output: null
2517
2705
  * ```
2518
2706
  */
2519
2707
  async srandmember(key, options) {
@@ -2535,14 +2723,18 @@ class BaseClient {
2535
2723
  * ```typescript
2536
2724
  * // Example usage of srandmemberCount method to return multiple random members from a set
2537
2725
  * const result = await client.srandmemberCount("my_set", -3);
2538
- * console.log(result); // Output: ['member1', 'member1', 'member2'] - Random members of "my_set".
2726
+ * console.log(result);
2727
+ * // Output: ['member1', 'member1', 'member2']
2728
+ * // Random members of `my_set`.
2539
2729
  * ```
2540
2730
  *
2541
2731
  * @example
2542
2732
  * ```typescript
2543
2733
  * // Example usage of srandmemberCount method with non-existing key
2544
2734
  * const result = await client.srandmemberCount("non_existing_set", 3);
2545
- * console.log(result); // Output: [] - An empty list since the key does not exist.
2735
+ * console.log(result);
2736
+ * // Output: []
2737
+ * // An empty list since the key does not exist.
2546
2738
  * ```
2547
2739
  */
2548
2740
  async srandmemberCount(key, count, options) {
@@ -2569,7 +2761,9 @@ class BaseClient {
2569
2761
  * ```typescript
2570
2762
  * // Example usage of the exists method
2571
2763
  * const result = await client.exists(["key1", "key2", "key3"]);
2572
- * console.log(result); // Output: 3 - Indicates that all three keys exist in the database.
2764
+ * console.log(result);
2765
+ * // Output: 3
2766
+ * // Indicates that all three keys exist in the database.
2573
2767
  * ```
2574
2768
  */
2575
2769
  async exists(keys) {
@@ -2597,7 +2791,9 @@ class BaseClient {
2597
2791
  * ```typescript
2598
2792
  * // Example usage of the unlink method
2599
2793
  * const result = await client.unlink(["key1", "key2", "key3"]);
2600
- * console.log(result); // Output: 3 - Indicates that all three keys were unlinked from the database.
2794
+ * console.log(result);
2795
+ * // Output: 3
2796
+ * // Indicates that all three keys were unlinked from the database.
2601
2797
  * ```
2602
2798
  */
2603
2799
  async unlink(keys) {
@@ -2622,14 +2818,18 @@ class BaseClient {
2622
2818
  * ```typescript
2623
2819
  * // Example usage of the expire method
2624
2820
  * const result = await client.expire("my_key", 60);
2625
- * console.log(result); // Output: true - Indicates that a timeout of 60 seconds has been set for "my_key".
2821
+ * console.log(result);
2822
+ * // Output: true
2823
+ * // Indicates that a timeout of 60 seconds has been set for `my_key`.
2626
2824
  * ```
2627
2825
  *
2628
2826
  * @example
2629
2827
  * ```typescript
2630
2828
  * // Example usage of the expire method with exisiting expiry
2631
2829
  * const result = await client.expire("my_key", 60, { expireOption: ExpireOptions.HasNoExpiry });
2632
- * console.log(result); // Output: false - Indicates that "my_key" has an existing expiry.
2830
+ * console.log(result);
2831
+ * // Output: false
2832
+ * // Indicates that `my_key` has an existing expiry.
2633
2833
  * ```
2634
2834
  */
2635
2835
  async expire(key, seconds, options) {
@@ -2654,7 +2854,9 @@ class BaseClient {
2654
2854
  * ```typescript
2655
2855
  * // Example usage of the expireAt method on a key with no previous expiry
2656
2856
  * const result = await client.expireAt("my_key", 1672531200, { expireOption: ExpireOptions.HasNoExpiry });
2657
- * console.log(result); // Output: true - Indicates that the expiration time for "my_key" was successfully set.
2857
+ * console.log(result);
2858
+ * // Output: true
2859
+ * // Indicates that the expiration time for `my_key` was successfully set.
2658
2860
  * ```
2659
2861
  */
2660
2862
  async expireAt(key, unixSeconds, options) {
@@ -2673,15 +2875,21 @@ class BaseClient {
2673
2875
  * @example
2674
2876
  * ```typescript
2675
2877
  * const result1 = await client.expiretime("myKey");
2676
- * console.log(result1); // Output: -2 - myKey doesn't exist.
2878
+ * console.log(result1);
2879
+ * // Output: -2
2880
+ * // `myKey` doesn't exist.
2677
2881
  *
2678
- * const result2 = await client.set(myKey, "value");
2679
- * const result3 = await client.expireTime(myKey);
2680
- * console.log(result2); // Output: -1 - myKey has no associated expiration.
2882
+ * const result2 = await client.set("myKey", "value");
2883
+ * const result3 = await client.expireTime("myKey");
2884
+ * console.log(result3);
2885
+ * // Output: -1
2886
+ * // `myKey` has no associated expiration.
2681
2887
  *
2682
2888
  * client.expire(myKey, 60);
2683
- * const result3 = await client.expireTime(myKey);
2684
- * console.log(result3); // Output: 123456 - the Unix timestamp (in seconds) when "myKey" will expire.
2889
+ * const result3 = await client.expireTime("myKey");
2890
+ * console.log(result3);
2891
+ * // Output: 123456
2892
+ * // The Unix timestamp (in seconds) when `myKey` will expire.
2685
2893
  * ```
2686
2894
  */
2687
2895
  async expiretime(key) {
@@ -2706,7 +2914,9 @@ class BaseClient {
2706
2914
  * ```typescript
2707
2915
  * // Example usage of the pexpire method on a key with no previous expiry
2708
2916
  * const result = await client.pexpire("my_key", 60000, { expireOption: ExpireOptions.HasNoExpiry });
2709
- * console.log(result); // Output: true - Indicates that a timeout of 60,000 milliseconds has been set for "my_key".
2917
+ * console.log(result);
2918
+ * // Output: true
2919
+ * // Indicates that a timeout of 60,000 milliseconds has been set for `my_key`.
2710
2920
  * ```
2711
2921
  */
2712
2922
  async pexpire(key, milliseconds, options) {
@@ -2731,7 +2941,9 @@ class BaseClient {
2731
2941
  * ```typescript
2732
2942
  * // Example usage of the pexpireAt method on a key with no previous expiry
2733
2943
  * const result = await client.pexpireAt("my_key", 1672531200000, { expireOption: ExpireOptions.HasNoExpiry });
2734
- * console.log(result); // Output: true - Indicates that the expiration time for "my_key" was successfully set.
2944
+ * console.log(result);
2945
+ * // Output: true
2946
+ * // Indicates that the expiration time for `my_key` was successfully set.
2735
2947
  * ```
2736
2948
  */
2737
2949
  async pexpireAt(key, unixMilliseconds, options) {
@@ -2749,15 +2961,21 @@ class BaseClient {
2749
2961
  * @example
2750
2962
  * ```typescript
2751
2963
  * const result1 = client.pexpiretime("myKey");
2752
- * console.log(result1); // Output: -2 - myKey doesn't exist.
2964
+ * console.log(result1);
2965
+ * // Output: -2
2966
+ * // `myKey` doesn't exist.
2753
2967
  *
2754
2968
  * const result2 = client.set(myKey, "value");
2755
2969
  * const result3 = client.pexpireTime(myKey);
2756
- * console.log(result2); // Output: -1 - myKey has no associated expiration.
2970
+ * console.log(result2);
2971
+ * // Output: -1
2972
+ * // `myKey` has no associated expiration.
2757
2973
  *
2758
2974
  * client.expire(myKey, 60);
2759
2975
  * const result3 = client.pexpireTime(myKey);
2760
- * console.log(result3); // Output: 123456789 - the Unix timestamp (in milliseconds) when "myKey" will expire.
2976
+ * console.log(result3);
2977
+ * // Output: 123456789
2978
+ * // The Unix timestamp (in milliseconds) when `myKey` will expire.
2761
2979
  * ```
2762
2980
  */
2763
2981
  async pexpiretime(key) {
@@ -2775,21 +2993,27 @@ class BaseClient {
2775
2993
  * ```typescript
2776
2994
  * // Example usage of the ttl method with existing key
2777
2995
  * const result = await client.ttl("my_key");
2778
- * console.log(result); // Output: 3600 - Indicates that "my_key" has a remaining time to live of 3600 seconds.
2996
+ * console.log(result);
2997
+ * // Output: 3600
2998
+ * // Indicates that `my_key` has a remaining time to live of 3600 seconds.
2779
2999
  * ```
2780
3000
  *
2781
3001
  * @example
2782
3002
  * ```typescript
2783
3003
  * // Example usage of the ttl method with existing key that has no associated expire.
2784
3004
  * const result = await client.ttl("key");
2785
- * console.log(result); // Output: -1 - Indicates that the key has no associated expire.
3005
+ * console.log(result);
3006
+ * // Output: -1
3007
+ * // Indicates that the key has no associated expire.
2786
3008
  * ```
2787
3009
  *
2788
3010
  * @example
2789
3011
  * ```typescript
2790
3012
  * // Example usage of the ttl method with a non-existing key
2791
3013
  * const result = await client.ttl("nonexistent_key");
2792
- * console.log(result); // Output: -2 - Indicates that the key doesn't exist.
3014
+ * console.log(result);
3015
+ * // Output: -2
3016
+ * // Indicates that the key doesn't exist.
2793
3017
  * ```
2794
3018
  */
2795
3019
  async ttl(key) {
@@ -2819,7 +3043,9 @@ class BaseClient {
2819
3043
  * args: ["bar"],
2820
3044
  * };
2821
3045
  * const result = await invokeScript(luaScript, scriptOptions);
2822
- * console.log(result); // Output: ['foo', 'bar']
3046
+ * console.log(result);
3047
+ * // Output: ['foo', 'bar']
3048
+ * // The result for the script.
2823
3049
  * ```
2824
3050
  */
2825
3051
  async invokeScript(script, options) {
@@ -2845,7 +3071,9 @@ class BaseClient {
2845
3071
  * ```typescript
2846
3072
  * const scriptHash = script.getHash();
2847
3073
  * const scriptSource = await client.scriptShow(scriptHash);
2848
- * console.log(scriptSource); // Output: "return { KEYS[1], ARGV[1] }"
3074
+ * console.log(scriptSource);
3075
+ * // Output: "return { KEYS[1], ARGV[1] }"
3076
+ * // The source for the script
2849
3077
  * ```
2850
3078
  */
2851
3079
  async scriptShow(sha1, options) {
@@ -2880,7 +3108,8 @@ class BaseClient {
2880
3108
  * // {
2881
3109
  * // "0-1": [["field1", "value1"]],
2882
3110
  * // "0-2": [["field2", "value2"], ["field2", "value3"]],
2883
- * // } // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in "mystream".
3111
+ * // }
3112
+ * // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in `mystream`.
2884
3113
  * ```
2885
3114
  */
2886
3115
  async xrange(key, start, end, options) {
@@ -2916,7 +3145,8 @@ class BaseClient {
2916
3145
  * // {
2917
3146
  * // "0-2": [["field2", "value2"], ["field2", "value3"]],
2918
3147
  * // "0-1": [["field1", "value1"]],
2919
- * // } // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in "mystream".
3148
+ * // }
3149
+ * // Indicates the stream entry IDs and their associated field-value pairs for all stream entries in `mystream`.
2920
3150
  * ```
2921
3151
  */
2922
3152
  async xrevrange(key, end, start, options) {
@@ -2939,7 +3169,9 @@ class BaseClient {
2939
3169
  * // Example usage of the zadd method to add elements to a sorted set
2940
3170
  * const data = [{ element: "member1", score: 10.5 }, { element: "member2", score: 8.2 }]
2941
3171
  * const result = await client.zadd("my_sorted_set", data);
2942
- * console.log(result); // Output: 2 - Indicates that two elements have been added to the sorted set "my_sorted_set."
3172
+ * console.log(result);
3173
+ * // Output: 2
3174
+ * // Indicates that two elements have been added to the sorted set `my_sorted_set`.
2943
3175
  * ```
2944
3176
  *
2945
3177
  * @example
@@ -2947,7 +3179,9 @@ class BaseClient {
2947
3179
  * // Example usage of the zadd method to update scores in an existing sorted set
2948
3180
  * const options = { conditionalChange: ConditionalChange.ONLY_IF_EXISTS, changed: true };
2949
3181
  * const result = await client.zadd("existing_sorted_set", { "member1": 10.5, "member2": 8.2 }, options);
2950
- * console.log(result); // Output: 2 - Updates the scores of two existing members in the sorted set "existing_sorted_set."
3182
+ * console.log(result);
3183
+ * // Output: 2
3184
+ * // Updates the scores of two existing members in the sorted set `existing_sorted_set`.
2951
3185
  * ```
2952
3186
  */
2953
3187
  async zadd(key, membersAndScores, options) {
@@ -2971,14 +3205,18 @@ class BaseClient {
2971
3205
  * ```typescript
2972
3206
  * // Example usage of the zaddIncr method to add a member with a score to a sorted set
2973
3207
  * const result = await client.zaddIncr("my_sorted_set", member, 5.0);
2974
- * console.log(result); // Output: 5.0
3208
+ * console.log(result);
3209
+ * // Output: 5.0
3210
+ * // Score of the member after being updated.
2975
3211
  * ```
2976
3212
  *
2977
3213
  * @example
2978
3214
  * ```typescript
2979
3215
  * // Example usage of the zaddIncr method to add or update a member with a score in an existing sorted set
2980
3216
  * const result = await client.zaddIncr("existing_sorted_set", member, "3.0", { updateOptions: UpdateByScore.LESS_THAN });
2981
- * console.log(result); // Output: null - Indicates that the member in the sorted set haven't been updated.
3217
+ * console.log(result);
3218
+ * // Output: null
3219
+ * // Indicates that the member in the sorted set haven't been updated.
2982
3220
  * ```
2983
3221
  */
2984
3222
  async zaddIncr(key, member, increment, options) {
@@ -2999,14 +3237,18 @@ class BaseClient {
2999
3237
  * ```typescript
3000
3238
  * // Example usage of the zrem function to remove members from a sorted set
3001
3239
  * const result = await client.zrem("my_sorted_set", ["member1", "member2"]);
3002
- * console.log(result); // Output: 2 - Indicates that two members have been removed from the sorted set "my_sorted_set."
3240
+ * console.log(result);
3241
+ * // Output: 2
3242
+ * // Indicates that two members have been removed from the sorted set `my_sorted_set`.
3003
3243
  * ```
3004
3244
  *
3005
3245
  * @example
3006
3246
  * ```typescript
3007
3247
  * // Example usage of the zrem function when the sorted set does not exist
3008
3248
  * const result = await client.zrem("non_existing_sorted_set", ["member1", "member2"]);
3009
- * console.log(result); // Output: 0 - Indicates that no members were removed as the sorted set "non_existing_sorted_set" does not exist.
3249
+ * console.log(result);
3250
+ * // Output: 0
3251
+ * // Indicates that no members were removed as the sorted set `non_existing_sorted_set` does not exist.
3010
3252
  * ```
3011
3253
  */
3012
3254
  async zrem(key, members) {
@@ -3025,14 +3267,17 @@ class BaseClient {
3025
3267
  * ```typescript
3026
3268
  * // Example usage of the zcard method to get the cardinality of a sorted set
3027
3269
  * const result = await client.zcard("my_sorted_set");
3028
- * console.log(result); // Output: 3 - Indicates that there are 3 elements in the sorted set "my_sorted_set".
3270
+ * console.log(result);
3271
+ * // Output: 3
3272
+ * // Indicates that there are 3 elements in the sorted set `my_sorted_set`.
3029
3273
  * ```
3030
3274
  *
3031
3275
  * @example
3032
3276
  * ```typescript
3033
3277
  * // Example usage of the zcard method with a non-existing key
3034
3278
  * const result = await client.zcard("non_existing_key");
3035
- * console.log(result); // Output: 0
3279
+ * console.log(result);
3280
+ * // Output: 0
3036
3281
  * ```
3037
3282
  */
3038
3283
  async zcard(key) {
@@ -3053,7 +3298,9 @@ class BaseClient {
3053
3298
  * @example
3054
3299
  * ```typescript
3055
3300
  * const cardinality = await client.zintercard(["key1", "key2"], { limit: 10 });
3056
- * console.log(cardinality); // Output: 3 - The intersection of the sorted sets at "key1" and "key2" has a cardinality of 3.
3301
+ * console.log(cardinality);
3302
+ * // Output: 3
3303
+ * // The intersection of the sorted sets at `key1` and `key2` has a cardinality of 3.
3057
3304
  * ```
3058
3305
  */
3059
3306
  async zintercard(keys, options) {
@@ -3078,7 +3325,9 @@ class BaseClient {
3078
3325
  * await client.zadd("zset2", {"member2": 2.0});
3079
3326
  * await client.zadd("zset3", {"member3": 3.0});
3080
3327
  * const result = await client.zdiff(["zset1", "zset2", "zset3"]);
3081
- * console.log(result); // Output: ["member1"] - "member1" is in "zset1" but not "zset2" or "zset3".
3328
+ * console.log(result);
3329
+ * // Output: ["member1"]
3330
+ * // `member1` is in `zset1` but not `zset2` or `zset3`.
3082
3331
  * ```
3083
3332
  */
3084
3333
  async zdiff(keys, options) {
@@ -3103,8 +3352,9 @@ class BaseClient {
3103
3352
  * await client.zadd("zset2", {"member2": 2.0});
3104
3353
  * await client.zadd("zset3", {"member3": 3.0});
3105
3354
  * const result = await client.zdiffWithScores(["zset1", "zset2", "zset3"]);
3106
- * console.log(result); // Output: "member1" is in "zset1" but not "zset2" or "zset3"
3107
- * // [{ element: "member1", score: 1.0 }]
3355
+ * console.log(result);
3356
+ * // Output: [{ element: "member1", score: 1.0 }]
3357
+ * // `member1` is in `zset1` but not `zset2` or `zset3`
3108
3358
  * ```
3109
3359
  */
3110
3360
  async zdiffWithScores(keys, options) {
@@ -3128,10 +3378,14 @@ class BaseClient {
3128
3378
  * await client.zadd("zset1", {"member1": 1.0, "member2": 2.0});
3129
3379
  * await client.zadd("zset2", {"member1": 1.0});
3130
3380
  * const result1 = await client.zdiffstore("zset3", ["zset1", "zset2"]);
3131
- * console.log(result1); // Output: 1 - One member exists in "key1" but not "key2", and this member was stored in "zset3".
3381
+ * console.log(result1);
3382
+ * // Output: 1
3383
+ * // One member exists in `key1` but not `key2`, and this member was stored in `zset3`.
3132
3384
  *
3133
3385
  * const result2 = await client.zrange("zset3", {start: 0, end: -1});
3134
- * console.log(result2); // Output: ["member2"] - "member2" is now stored in "my_sorted_set".
3386
+ * console.log(result2);
3387
+ * // Output: ["member2"]
3388
+ * // `member2` is now stored in `my_sorted_set`.
3135
3389
  * ```
3136
3390
  */
3137
3391
  async zdiffstore(destination, keys) {
@@ -3152,21 +3406,25 @@ class BaseClient {
3152
3406
  * ```typescript
3153
3407
  * // Example usage of the zscore method∂∂ to get the score of a member in a sorted set
3154
3408
  * const result = await client.zscore("my_sorted_set", "member");
3155
- * console.log(result); // Output: 10.5 - Indicates that the score of "member" in the sorted set "my_sorted_set" is 10.5.
3409
+ * console.log(result);
3410
+ * // Output: 10.5
3411
+ * // Indicates that the score of `member` in the sorted set `my_sorted_set` is 10.5.
3156
3412
  * ```
3157
3413
  *
3158
3414
  * @example
3159
3415
  * ```typescript
3160
3416
  * // Example usage of the zscore method when the member does not exist in the sorted set
3161
3417
  * const result = await client.zscore("my_sorted_set", "non_existing_member");
3162
- * console.log(result); // Output: null
3418
+ * console.log(result);
3419
+ * // Output: null
3163
3420
  * ```
3164
3421
  *
3165
3422
  * @example
3166
3423
  * ```typescript
3167
3424
  * // Example usage of the zscore method with non existimng key
3168
3425
  * const result = await client.zscore("non_existing_set", "member");
3169
- * console.log(result); // Output: null
3426
+ * console.log(result);
3427
+ * // Output: null
3170
3428
  * ```
3171
3429
  */
3172
3430
  async zscore(key, member) {
@@ -3196,25 +3454,35 @@ class BaseClient {
3196
3454
  *
3197
3455
  * // use `zunionstore` with default aggregation and weights
3198
3456
  * console.log(await client.zunionstore("my_sorted_set", ["key1", "key2"]))
3199
- * // Output: 2 - Indicates that the sorted set "my_sorted_set" contains two elements.
3457
+ * // Output: 2
3458
+ * // Indicates that the sorted set `my_sorted_set` contains two elements.
3459
+ *
3200
3460
  * console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
3201
- * // Output: {'member1': 20, 'member2': 8.2} - "member1" is now stored in "my_sorted_set" with score of 20 and "member2" with score of 8.2.
3461
+ * // Output: {'member1': 20, 'member2': 8.2}
3462
+ * // `member1` is now stored in `my_sorted_set` with score of 20 and `member2` with score of 8.2.
3202
3463
  * ```
3203
3464
  *
3204
3465
  * @example
3205
3466
  * ```typescript
3206
3467
  * // use `zunionstore` with default weights
3207
3468
  * console.log(await client.zunionstore("my_sorted_set", ["key1", "key2"], { aggregationType: AggregationType.MAX }))
3208
- * // Output: 2 - Indicates that the sorted set "my_sorted_set" contains two elements, and each score is the maximum score between the sets.
3469
+ * // Output: 2
3470
+ * // Indicates that the sorted set `my_sorted_set` contains two elements, and each score is the maximum score between the sets.
3471
+ *
3209
3472
  * console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
3210
- * // Output: {'member1': 10.5, 'member2': 8.2} - "member1" is now stored in "my_sorted_set" with score of 10.5 and "member2" with score of 8.2.
3473
+ * // Output: {'member1': 10.5, 'member2': 8.2}
3474
+ * // `member1` is now stored in `my_sorted_set` with score of 10.5 and `member2` with score of 8.2.
3211
3475
  * ```
3212
3476
  *
3213
3477
  * @example
3214
3478
  * ```typescript
3215
3479
  * // use `zunionstore` with default aggregation
3216
- * console.log(await client.zunionstore("my_sorted_set", [["key1", 2], ["key2", 1]])) // Output: 2
3217
- * console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1})) // Output: { member2: 16.4, member1: 30.5 }
3480
+ * console.log(await client.zunionstore("my_sorted_set", [["key1", 2], ["key2", 1]]))
3481
+ * // Output: 2
3482
+ * // Indicates that the sorted set `my_sorted_set` contains two elements
3483
+ *
3484
+ * console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, stop: -1}))
3485
+ * // Output: { member2: 16.4, member1: 30.5 }
3218
3486
  * ```
3219
3487
  */
3220
3488
  async zunionstore(destination, keys, options) {
@@ -3234,7 +3502,8 @@ class BaseClient {
3234
3502
  * @example
3235
3503
  * ```typescript
3236
3504
  * const result = await client.zmscore("zset1", ["member1", "non_existent_member", "member2"]);
3237
- * console.log(result); // Output: [1.0, null, 2.0] - "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.
3505
+ * console.log(result); // Output: [1.0, null, 2.0]
3506
+ * // `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.
3238
3507
  * ```
3239
3508
  */
3240
3509
  async zmscore(key, members) {
@@ -3256,14 +3525,18 @@ class BaseClient {
3256
3525
  * ```typescript
3257
3526
  * // Example usage of the zcount method to count members in a sorted set within a score range
3258
3527
  * const result = await client.zcount("my_sorted_set", { value: 5.0, isInclusive: true }, InfBoundary.PositiveInfinity);
3259
- * console.log(result); // Output: 2 - Indicates that there are 2 members with scores between 5.0 (inclusive) and +inf in the sorted set "my_sorted_set".
3528
+ * console.log(result);
3529
+ * // Output: 2
3530
+ * // Indicates that there are 2 members with scores between 5.0 (inclusive) and +inf in the sorted set `my_sorted_set`.
3260
3531
  * ```
3261
3532
  *
3262
3533
  * @example
3263
3534
  * ```typescript
3264
3535
  * // Example usage of the zcount method to count members in a sorted set within a score range
3265
3536
  * const result = await client.zcount("my_sorted_set", { value: 5.0, isInclusive: true }, { value: 10.0, isInclusive: false });
3266
- * console.log(result); // Output: 1 - Indicates that there is one member with score between 5.0 (inclusive) and 10.0 (exclusive) in the sorted set "my_sorted_set".
3537
+ * console.log(result);
3538
+ * // Output: 1
3539
+ * // Indicates that there is one member with score between 5.0 (inclusive) and 10.0 (exclusive) in the sorted set `my_sorted_set`.
3267
3540
  * ```
3268
3541
  */
3269
3542
  async zcount(key, minScore, maxScore) {
@@ -3292,8 +3565,9 @@ class BaseClient {
3292
3565
  * ```typescript
3293
3566
  * // Example usage of zrange method to retrieve all members of a sorted set in ascending order
3294
3567
  * const result = await client.zrange("my_sorted_set", { start: 0, end: -1 });
3295
- * console.log(result1); // Output: all members in ascending order
3296
- * // ['member1', 'member2', 'member3']
3568
+ * console.log(result1);
3569
+ * // Output: ['member1', 'member2', 'member3']
3570
+ * // All members in ascending order
3297
3571
  * ```
3298
3572
  * @example
3299
3573
  * ```typescript
@@ -3303,8 +3577,9 @@ class BaseClient {
3303
3577
  * end: InfBoundary.NegativeInfinity,
3304
3578
  * type: "byScore",
3305
3579
  * }, { reverse: true });
3306
- * console.log(result); // Output: members with scores within the range of negative infinity to 3, in descending order
3307
- * // ['member2', 'member1']
3580
+ * console.log(result);
3581
+ * // Output: ['member2', 'member1']
3582
+ * // Members with scores within the range of negative infinity to 3, in descending order
3308
3583
  * ```
3309
3584
  */
3310
3585
  async zrange(key, rangeQuery, options) {
@@ -3334,8 +3609,9 @@ class BaseClient {
3334
3609
  * end: { value: 20, isInclusive: false },
3335
3610
  * type: "byScore",
3336
3611
  * });
3337
- * console.log(result); // Output: members with scores between 10 and 20 with their scores
3338
- * // [{ element: 'member1', score: 10.5 }, { element: 'member2', score: 15.2 }]
3612
+ * console.log(result);
3613
+ * // Output: [{ element: 'member1', score: 10.5 }, { element: 'member2', score: 15.2 }]
3614
+ * // Members with scores between 10 and 20 with their scores
3339
3615
  * ```
3340
3616
  * @example
3341
3617
  * ```typescript
@@ -3345,8 +3621,9 @@ class BaseClient {
3345
3621
  * end: InfBoundary.NegativeInfinity,
3346
3622
  * type: "byScore",
3347
3623
  * }, { reverse: true });
3348
- * console.log(result); // Output: members with scores within the range of negative infinity to 3, with their scores
3349
- * // [{ element: 'member7', score: 1.5 }, { element: 'member4', score: -2.0 }]
3624
+ * console.log(result);
3625
+ * // Output: [{ element: 'member7', score: 1.5 }, { element: 'member4', score: -2.0 }]
3626
+ * // Members with scores within the range of negative infinity to 3, with their scores
3350
3627
  * ```
3351
3628
  */
3352
3629
  async zrangeWithScores(key, rangeQuery, options) {
@@ -3374,17 +3651,21 @@ class BaseClient {
3374
3651
  * ```typescript
3375
3652
  * // Example usage of zrangeStore to retrieve and store all members of a sorted set in ascending order.
3376
3653
  * const result = await client.zrangeStore("destination_key", "my_sorted_set", { start: 0, end: -1 });
3377
- * console.log(result); // Output: 7 - "destination_key" contains a sorted set with the 7 members from "my_sorted_set".
3654
+ * console.log(result);
3655
+ * // Output: 7
3656
+ * // `destination_key` contains a sorted set with the 7 members from `my_sorted_set`.
3378
3657
  * ```
3379
3658
  * @example
3380
3659
  * ```typescript
3381
- * // Example usage of zrangeStore method to retrieve members within a score range in ascending order and store in "destination_key"
3660
+ * // Example usage of zrangeStore method to retrieve members within a score range in ascending order and store in `destination_key`
3382
3661
  * const result = await client.zrangeStore("destination_key", "my_sorted_set", {
3383
3662
  * start: InfBoundary.NegativeInfinity,
3384
3663
  * end: { value: 3, isInclusive: false },
3385
3664
  * type: "byScore",
3386
3665
  * });
3387
- * console.log(result); // Output: 5 - Stores 5 members with scores within the range of negative infinity to 3, in ascending order, in "destination_key".
3666
+ * console.log(result);
3667
+ * // Output: 5
3668
+ * // Stores 5 members with scores within the range of negative infinity to 3, in ascending order, in `destination_key`.
3388
3669
  * ```
3389
3670
  */
3390
3671
  async zrangeStore(destination, source, rangeQuery, reverse = false) {
@@ -3414,15 +3695,21 @@ class BaseClient {
3414
3695
  *
3415
3696
  * // use `zinterstore` with default aggregation and weights
3416
3697
  * console.log(await client.zinterstore("my_sorted_set", ["key1", "key2"]))
3417
- * // Output: 1 - Indicates that the sorted set "my_sorted_set" contains one element.
3698
+ * // Output: 1
3699
+ * // Indicates that the sorted set `my_sorted_set` contains one element.
3700
+ *
3418
3701
  * console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, end: -1}))
3419
- * // Output: {'member1': 20} - "member1" is now stored in "my_sorted_set" with score of 20.
3702
+ * // Output: {'member1': 20}
3703
+ * // `member1` is now stored in `my_sorted_set` with score of 20.
3420
3704
  *
3421
3705
  * // use `zinterstore` with default weights
3422
3706
  * console.log(await client.zinterstore("my_sorted_set", ["key1", "key2"] , { aggregationType: AggregationType.MAX }))
3423
- * // Output: 1 - Indicates that the sorted set "my_sorted_set" contains one element, and it's score is the maximum score between the sets.
3707
+ * // Output: 1
3708
+ * // Indicates that the sorted set `my_sorted_set` contains one element, and it's score is the maximum score between the sets.
3709
+ *
3424
3710
  * console.log(await client.zrangeWithScores("my_sorted_set", {start: 0, end: -1}))
3425
- * // Output: {'member1': 10.5} - "member1" is now stored in "my_sorted_set" with score of 10.5.
3711
+ * // Output: {'member1': 10.5}
3712
+ * // `member1` is now stored in `my_sorted_set` with score of 10.5.
3426
3713
  * ```
3427
3714
  */
3428
3715
  async zinterstore(destination, keys, options) {
@@ -3448,7 +3735,9 @@ class BaseClient {
3448
3735
  * await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
3449
3736
  * await client.zadd("key2", {"member1": 9.5});
3450
3737
  * const result = await client.zinter(["key1", "key2"]);
3451
- * console.log(result); // Output: ['member1']
3738
+ * console.log(result);
3739
+ * // Output: ['member1']
3740
+ * // The intersecting element for the sorted sets at `key1` and `key2`.
3452
3741
  * ```
3453
3742
  */
3454
3743
  async zinter(keys, options) {
@@ -3480,11 +3769,14 @@ class BaseClient {
3480
3769
  * await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
3481
3770
  * await client.zadd("key2", {"member1": 9.5});
3482
3771
  * const result1 = await client.zinterWithScores(["key1", "key2"]);
3483
- * console.log(result1); // Output: "member1" with score of 20 is the result
3484
- * // [{ element: 'member1', score: 20 }]
3772
+ * console.log(result1);
3773
+ * // Output: [{ element: 'member1', score: 20 }]
3774
+ * // `member1` with score of 20 is the result
3775
+ *
3485
3776
  * const result2 = await client.zinterWithScores(["key1", "key2"], AggregationType.MAX)
3486
- * console.log(result2); // Output: "member1" with score of 10.5 is the result
3487
- * // [{ element: 'member1', score: 10.5 }]
3777
+ * console.log(result2);
3778
+ * // Output: [{ element: 'member1', score: 10.5 }]
3779
+ * // `member1` with score of 10.5 is the result
3488
3780
  * ```
3489
3781
  */
3490
3782
  async zinterWithScores(keys, options) {
@@ -3509,7 +3801,9 @@ class BaseClient {
3509
3801
  * await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
3510
3802
  * await client.zadd("key2", {"member1": 9.5});
3511
3803
  * const result = await client.zunion(["key1", "key2"]);
3512
- * console.log(result); // Output: ['member1', 'member2']
3804
+ * console.log(result);
3805
+ * // Output: ['member1', 'member2']
3806
+ * // Union elements from sets stored at keys `key1` and `key2`.
3513
3807
  * ```
3514
3808
  */
3515
3809
  async zunion(keys, options) {
@@ -3539,11 +3833,14 @@ class BaseClient {
3539
3833
  * await client.zadd("key1", {"member1": 10.5, "member2": 8.2});
3540
3834
  * await client.zadd("key2", {"member1": 9.5});
3541
3835
  * const result1 = await client.zunionWithScores(["key1", "key2"]);
3542
- * console.log(result1); // Output:
3543
- * // [{ element: 'member1', score: 20 }, { element: 'member2', score: 8.2 }]
3836
+ * console.log(result1);
3837
+ * // Output: [{ element: 'member1', score: 20 }, { element: 'member2', score: 8.2 }]
3838
+ * // A list of union elements with scores.
3839
+ *
3544
3840
  * const result2 = await client.zunionWithScores(["key1", "key2"], "MAX");
3545
- * console.log(result2); // Output:
3546
- * // [{ element: 'member1', score: 10.5}, { element: 'member2', score: 8.2 }]
3841
+ * console.log(result2);
3842
+ * // Output: [{ element: 'member1', score: 10.5}, { element: 'member2', score: 8.2 }]
3843
+ * // 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.
3547
3844
  * ```
3548
3845
  */
3549
3846
  async zunionWithScores(keys, options) {
@@ -3562,13 +3859,17 @@ class BaseClient {
3562
3859
  * @example
3563
3860
  * ```typescript
3564
3861
  * const payload1 = await client.zrandmember("mySortedSet");
3565
- * console.log(payload1); // Output: "Glide" (a random member from the set)
3862
+ * console.log(payload1);
3863
+ * // Output: "Glide"
3864
+ * // A random member from the set
3566
3865
  * ```
3567
3866
  *
3568
3867
  * @example
3569
3868
  * ```typescript
3570
3869
  * const payload2 = await client.zrandmember("nonExistingSortedSet");
3571
- * console.log(payload2); // Output: null since the sorted set does not exist.
3870
+ * console.log(payload2);
3871
+ * // Output: null
3872
+ * // Since the sorted set does not exist.
3572
3873
  * ```
3573
3874
  */
3574
3875
  async zrandmember(key, options) {
@@ -3590,13 +3891,17 @@ class BaseClient {
3590
3891
  * @example
3591
3892
  * ```typescript
3592
3893
  * const payload1 = await client.zrandmemberWithCount("mySortedSet", -3);
3593
- * console.log(payload1); // Output: ["Glide", "GLIDE", "node"]
3894
+ * console.log(payload1);
3895
+ * // Output: ["Glide", "GLIDE", "node"]
3896
+ * // Returns 3 random members from the sorted set, with duplicates allowed.
3594
3897
  * ```
3595
3898
  *
3596
3899
  * @example
3597
3900
  * ```typescript
3598
3901
  * const payload2 = await client.zrandmemberWithCount("nonExistingKey", 3);
3599
- * console.log(payload1); // Output: [] since the sorted set does not exist.
3902
+ * console.log(payload1);
3903
+ * // Output: []
3904
+ * // Since the sorted set does not exist.
3600
3905
  * ```
3601
3906
  */
3602
3907
  async zrandmemberWithCount(key, count, options) {
@@ -3618,13 +3923,17 @@ class BaseClient {
3618
3923
  * @example
3619
3924
  * ```typescript
3620
3925
  * const payload1 = await client.zrandmemberWithCountWithScore("mySortedSet", -3);
3621
- * console.log(payload1); // Output: [["Glide", 1.0], ["GLIDE", 1.0], ["node", 2.0]]
3926
+ * console.log(payload1);
3927
+ * // Output: [["Glide", 1.0], ["GLIDE", 1.0], ["node", 2.0]]
3928
+ * // Returns 3 random members with scores, with duplicates allowed.
3622
3929
  * ```
3623
3930
  *
3624
3931
  * @example
3625
3932
  * ```typescript
3626
3933
  * const payload2 = await client.zrandmemberWithCountWithScore("nonExistingKey", 3);
3627
- * console.log(payload1); // Output: [] since the sorted set does not exist.
3934
+ * console.log(payload1);
3935
+ * // Output: []
3936
+ * // Since the sorted set does not exist.
3628
3937
  * ```
3629
3938
  */
3630
3939
  async zrandmemberWithCountWithScores(key, count, options) {
@@ -3643,15 +3952,17 @@ class BaseClient {
3643
3952
  * ```typescript
3644
3953
  * // Example usage of strlen method with an existing key
3645
3954
  * await client.set("key", "GLIDE");
3646
- * const len1 = await client.strlen("key");
3647
- * console.log(len1); // Output: 5
3955
+ * const length1 = await client.strlen("key");
3956
+ * console.log(length1);
3957
+ * // Output: 5
3648
3958
  * ```
3649
3959
  *
3650
3960
  * @example
3651
3961
  * ```typescript
3652
3962
  * // Example usage of strlen method with a non-existing key
3653
- * const len2 = await client.strlen("non_existing_key");
3654
- * console.log(len2); // Output: 0
3963
+ * const length2 = await client.strlen("non_existing_key");
3964
+ * console.log(length2);
3965
+ * // Output: 0
3655
3966
  * ```
3656
3967
  */
3657
3968
  async strlen(key) {
@@ -3670,7 +3981,8 @@ class BaseClient {
3670
3981
  * // Example usage of type method with a string value
3671
3982
  * await client.set("key", "value");
3672
3983
  * const type = await client.type("key");
3673
- * console.log(type); // Output: 'string'
3984
+ * console.log(type);
3985
+ * // Output: 'string'
3674
3986
  * ```
3675
3987
  *
3676
3988
  * @example
@@ -3678,7 +3990,8 @@ class BaseClient {
3678
3990
  * // Example usage of type method with a list
3679
3991
  * await client.lpush("key", ["value"]);
3680
3992
  * const type = await client.type("key");
3681
- * console.log(type); // Output: 'list'
3993
+ * console.log(type);
3994
+ * // Output: 'list'
3682
3995
  * ```
3683
3996
  */
3684
3997
  async type(key) {
@@ -3705,21 +4018,22 @@ class BaseClient {
3705
4018
  * ```typescript
3706
4019
  * // Example usage of zpopmin method to remove and return the member with the lowest score from a sorted set
3707
4020
  * const result = await client.zpopmin("my_sorted_set");
3708
- * console.log(result); // Output:
3709
- * // 'member1' with a score of 5.0 has been removed from the sorted set
3710
- * // [{ element: 'member1', score: 5.0 }]
4021
+ * console.log(result);
4022
+ * // Output: [{ element: 'member1', score: 5.0 }]
4023
+ * // `member1` with a score of 5.0 has been removed from the sorted set
3711
4024
  * ```
3712
4025
  *
3713
4026
  * @example
3714
4027
  * ```typescript
3715
4028
  * // Example usage of zpopmin method to remove and return multiple members with the lowest scores from a sorted set
3716
4029
  * const result = await client.zpopmin("my_sorted_set", 2);
3717
- * console.log(result); // Output:
3718
- * // 'member3' with a score of 7.5 and 'member2' with a score of 8.0 have been removed from the sorted set
4030
+ * console.log(result);
4031
+ * // Output:
3719
4032
  * // [
3720
4033
  * // { element: 'member3', score: 7.5 },
3721
4034
  * // { element: 'member2', score: 8.0 }
3722
4035
  * // ]
4036
+ * // `member3` with a score of 7.5 and `member2` with a score of 8.0 have been removed from the sorted set
3723
4037
  * ```
3724
4038
  */
3725
4039
  async zpopmin(key, options) {
@@ -3744,7 +4058,9 @@ class BaseClient {
3744
4058
  * @example
3745
4059
  * ```typescript
3746
4060
  * const data = await client.bzpopmin(["zset1", "zset2"], 0.5);
3747
- * console.log(data); // Output: ["zset1", "a", 2];
4061
+ * console.log(data);
4062
+ * // Output: ["zset1", "a", 2];
4063
+ * // Pops the member `a` with score 2 stored at key `zset1`.
3748
4064
  * ```
3749
4065
  */
3750
4066
  async bzpopmin(keys, timeout, options) {
@@ -3769,21 +4085,22 @@ class BaseClient {
3769
4085
  * ```typescript
3770
4086
  * // Example usage of zpopmax method to remove and return the member with the highest score from a sorted set
3771
4087
  * const result = await client.zpopmax("my_sorted_set");
3772
- * console.log(result); // Output:
3773
- * // 'member1' with a score of 10.0 has been removed from the sorted set
3774
- * // [{ element: 'member1', score: 10.0 }]
4088
+ * console.log(result);
4089
+ * // Output: [{ element: 'member1', score: 10.0 }]
4090
+ * // `member1` with a score of 10.0 has been removed from the sorted set
3775
4091
  * ```
3776
4092
  *
3777
4093
  * @example
3778
4094
  * ```typescript
3779
4095
  * // Example usage of zpopmax method to remove and return multiple members with the highest scores from a sorted set
3780
4096
  * const result = await client.zpopmax("my_sorted_set", 2);
3781
- * console.log(result); // Output:
3782
- * // 'member3' with a score of 7.5 and 'member2' with a score of 8.0 have been removed from the sorted set
4097
+ * console.log(result);
4098
+ * // Output:
3783
4099
  * // [
3784
4100
  * // { element: 'member3', score: 7.5 },
3785
4101
  * // { element: 'member2', score: 8.0 }
3786
4102
  * // ]
4103
+ * // `member3` with a score of 7.5 and `member2` with a score of 8.0 have been removed from the sorted set
3787
4104
  * ```
3788
4105
  */
3789
4106
  async zpopmax(key, options) {
@@ -3808,7 +4125,8 @@ class BaseClient {
3808
4125
  * @example
3809
4126
  * ```typescript
3810
4127
  * const data = await client.bzpopmax(["zset1", "zset2"], 0.5);
3811
- * console.log(data); // Output: ["zset1", "c", 2];
4128
+ * console.log(data);
4129
+ * // Output: ["zset1", "c", 2];
3812
4130
  * ```
3813
4131
  */
3814
4132
  async bzpopmax(keys, timeout, options) {
@@ -3826,21 +4144,27 @@ class BaseClient {
3826
4144
  * ```typescript
3827
4145
  * // Example usage of pttl method with an existing key
3828
4146
  * const result = await client.pttl("my_key");
3829
- * console.log(result); // Output: 5000 - Indicates that the key "my_key" has a remaining time to live of 5000 milliseconds.
4147
+ * console.log(result);
4148
+ * // Output: 5000
4149
+ * // Indicates that the key `my_key` has a remaining time to live of 5000 milliseconds.
3830
4150
  * ```
3831
4151
  *
3832
4152
  * @example
3833
4153
  * ```typescript
3834
4154
  * // Example usage of pttl method with a non-existing key
3835
4155
  * const result = await client.pttl("non_existing_key");
3836
- * console.log(result); // Output: -2 - Indicates that the key "non_existing_key" does not exist.
4156
+ * console.log(result);
4157
+ * // Output: -2
4158
+ * // Indicates that the key `non_existing_key` does not exist.
3837
4159
  * ```
3838
4160
  *
3839
4161
  * @example
3840
4162
  * ```typescript
3841
4163
  * // Example usage of pttl method with an exisiting key that has no associated expire.
3842
4164
  * const result = await client.pttl("key");
3843
- * console.log(result); // Output: -1 - Indicates that the key "key" has no associated expire.
4165
+ * console.log(result);
4166
+ * // Output: -1
4167
+ * // Indicates that the key `key` has no associated expire.
3844
4168
  * ```
3845
4169
  */
3846
4170
  async pttl(key) {
@@ -3865,7 +4189,9 @@ class BaseClient {
3865
4189
  * ```typescript
3866
4190
  * // Example usage of zremRangeByRank method
3867
4191
  * const result = await client.zremRangeByRank("my_sorted_set", 0, 2);
3868
- * console.log(result); // Output: 3 - Indicates that three elements have been removed from the sorted set "my_sorted_set" between ranks 0 and 2.
4192
+ * console.log(result);
4193
+ * // Output: 3
4194
+ * // Indicates that three elements have been removed from the sorted set `my_sorted_set` between ranks 0 and 2.
3869
4195
  * ```
3870
4196
  */
3871
4197
  async zremRangeByRank(key, start, end) {
@@ -3887,14 +4213,18 @@ class BaseClient {
3887
4213
  * ```typescript
3888
4214
  * // Example usage of zremRangeByLex method to remove members from a sorted set based on lexicographical order range
3889
4215
  * const result = await client.zremRangeByLex("my_sorted_set", { value: "a", isInclusive: false }, { value: "e" });
3890
- * console.log(result); // Output: 4 - Indicates that 4 members, with lexicographical values ranging from "a" (exclusive) to "e" (inclusive), have been removed from "my_sorted_set".
4216
+ * console.log(result);
4217
+ * // Output: 4
4218
+ * // Indicates that 4 members, with lexicographical values ranging from `a` (exclusive) to `e` (inclusive), have been removed from `my_sorted_set`.
3891
4219
  * ```
3892
4220
  *
3893
4221
  * @example
3894
4222
  * ```typescript
3895
4223
  * // Example usage of zremRangeByLex method when the sorted set does not exist
3896
4224
  * const result = await client.zremRangeByLex("non_existing_sorted_set", InfBoundary.NegativeInfinity, { value: "e" });
3897
- * console.log(result); // Output: 0 - Indicates that no elements were removed.
4225
+ * console.log(result);
4226
+ * // Output: 0
4227
+ * // Indicates that no elements were removed.
3898
4228
  * ```
3899
4229
  */
3900
4230
  async zremRangeByLex(key, minLex, maxLex) {
@@ -3916,14 +4246,18 @@ class BaseClient {
3916
4246
  * ```typescript
3917
4247
  * // Example usage of zremRangeByScore method to remove members from a sorted set based on score range
3918
4248
  * const result = await client.zremRangeByScore("my_sorted_set", { value: 5.0, isInclusive: true }, InfBoundary.PositiveInfinity);
3919
- * console.log(result); // Output: 2 - Indicates that 2 members with scores between 5.0 (inclusive) and +inf have been removed from the sorted set "my_sorted_set".
4249
+ * console.log(result);
4250
+ * // Output: 2
4251
+ * // Indicates that 2 members with scores between 5.0 (inclusive) and +inf have been removed from the sorted set `my_sorted_set`.
3920
4252
  * ```
3921
4253
  *
3922
4254
  * @example
3923
4255
  * ```typescript
3924
4256
  * // Example usage of zremRangeByScore method when the sorted set does not exist
3925
4257
  * const result = await client.zremRangeByScore("non_existing_sorted_set", { value: 5.0, isInclusive: true }, { value: 10.0, isInclusive: false });
3926
- * console.log(result); // Output: 0 - Indicates that no members were removed as the sorted set "non_existing_sorted_set" does not exist.
4258
+ * console.log(result);
4259
+ * // Output: 0
4260
+ * // Indicates that no members were removed as the sorted set `non_existing_sorted_set` does not exist.
3927
4261
  * ```
3928
4262
  */
3929
4263
  async zremRangeByScore(key, minScore, maxScore) {
@@ -3944,13 +4278,17 @@ class BaseClient {
3944
4278
  * @example
3945
4279
  * ```typescript
3946
4280
  * const result = await client.zlexcount("my_sorted_set", {value: "c"}, InfBoundary.PositiveInfinity);
3947
- * console.log(result); // Output: 2 - Indicates that there are 2 members with lex scores between "c" (inclusive) and positive infinity in the sorted set "my_sorted_set".
4281
+ * console.log(result);
4282
+ * // Output: 2
4283
+ * // Indicates that there are 2 members with lex scores between `c` (inclusive) and positive infinity in the sorted set `my_sorted_set`.
3948
4284
  * ```
3949
4285
  *
3950
4286
  * @example
3951
4287
  * ```typescript
3952
4288
  * const result = await client.zlexcount("my_sorted_set", {value: "c"}, {value: "k", isInclusive: false});
3953
- * console.log(result); // Output: 1 - Indicates that there is one member with a lex score between "c" (inclusive) and "k" (exclusive) in the sorted set "my_sorted_set".
4289
+ * console.log(result);
4290
+ * // Output: 1
4291
+ * // Indicates that there is one member with a lex score between `c` (inclusive) and `k` (exclusive) in the sorted set `my_sorted_set`.
3954
4292
  * ```
3955
4293
  */
3956
4294
  async zlexcount(key, minLex, maxLex) {
@@ -3971,14 +4309,18 @@ class BaseClient {
3971
4309
  * ```typescript
3972
4310
  * // Example usage of zrank method to retrieve the rank of a member in a sorted set
3973
4311
  * const result = await client.zrank("my_sorted_set", "member2");
3974
- * console.log(result); // Output: 1 - Indicates that "member2" has the second-lowest score in the sorted set "my_sorted_set".
4312
+ * console.log(result);
4313
+ * // Output: 1
4314
+ * // Indicates that `member2` has the second-lowest score in the sorted set `my_sorted_set`.
3975
4315
  * ```
3976
4316
  *
3977
4317
  * @example
3978
4318
  * ```typescript
3979
4319
  * // Example usage of zrank method with a non-existing member
3980
4320
  * const result = await client.zrank("my_sorted_set", "non_existing_member");
3981
- * console.log(result); // Output: null - Indicates that "non_existing_member" is not present in the sorted set "my_sorted_set".
4321
+ * console.log(result);
4322
+ * // Output: null
4323
+ * // Indicates that `non_existing_member` is not present in the sorted set `my_sorted_set`.
3982
4324
  * ```
3983
4325
  */
3984
4326
  async zrank(key, member) {
@@ -3999,14 +4341,18 @@ class BaseClient {
3999
4341
  * ```typescript
4000
4342
  * // Example usage of zrank_withscore method to retrieve the rank and score of a member in a sorted set
4001
4343
  * const result = await client.zrank_withscore("my_sorted_set", "member2");
4002
- * console.log(result); // Output: [1, 6.0] - Indicates that "member2" with score 6.0 has the second-lowest score in the sorted set "my_sorted_set".
4344
+ * console.log(result);
4345
+ * // Output: [1, 6.0]
4346
+ * // Indicates that `member2` with score 6.0 has the second-lowest score in the sorted set `my_sorted_set`.
4003
4347
  * ```
4004
4348
  *
4005
4349
  * @example
4006
4350
  * ```typescript
4007
4351
  * // Example usage of zrank_withscore method with a non-existing member
4008
4352
  * const result = await client.zrank_withscore("my_sorted_set", "non_existing_member");
4009
- * console.log(result); // Output: null - Indicates that "non_existing_member" is not present in the sorted set "my_sorted_set".
4353
+ * console.log(result);
4354
+ * // Output: null
4355
+ * // Indicates that `non_existing_member` is not present in the sorted set `my_sorted_set`.
4010
4356
  * ```
4011
4357
  */
4012
4358
  async zrankWithScore(key, member) {
@@ -4027,7 +4373,9 @@ class BaseClient {
4027
4373
  * @example
4028
4374
  * ```typescript
4029
4375
  * const result = await client.zrevrank("my_sorted_set", "member2");
4030
- * console.log(result); // Output: 1 - Indicates that "member2" has the second-highest score in the sorted set "my_sorted_set".
4376
+ * console.log(result);
4377
+ * // Output: 1
4378
+ * // Indicates that `member2` has the second-highest score in the sorted set `my_sorted_set`.
4031
4379
  * ```
4032
4380
  */
4033
4381
  async zrevrank(key, member) {
@@ -4049,7 +4397,9 @@ class BaseClient {
4049
4397
  * @example
4050
4398
  * ```typescript
4051
4399
  * const result = await client.zrevankWithScore("my_sorted_set", "member2");
4052
- * console.log(result); // Output: [1, 6.0] - Indicates that "member2" with score 6.0 has the second-highest score in the sorted set "my_sorted_set".
4400
+ * console.log(result);
4401
+ * // Output: [1, 6.0]
4402
+ * // Indicates that `member2` with score 6.0 has the second-highest score in the sorted set `my_sorted_set`.
4053
4403
  * ```
4054
4404
  */
4055
4405
  async zrevrankWithScore(key, member) {
@@ -4082,7 +4432,8 @@ class BaseClient {
4082
4432
  * @example
4083
4433
  * ```typescript
4084
4434
  * console.log(await client.xdel("key", ["1538561698944-0", "1538561698944-1"]));
4085
- * // Output is 2 since the stream marked 2 entries as deleted.
4435
+ * // Output: 2
4436
+ * // the stream marked 2 entries as deleted.
4086
4437
  * ```
4087
4438
  */
4088
4439
  async xdel(key, ids) {
@@ -4112,12 +4463,13 @@ class BaseClient {
4112
4463
  * @example
4113
4464
  * ```typescript
4114
4465
  * const streamResults = await client.xread({"my_stream": "0-0", "writers": "0-0"});
4115
- * console.log(result); // Output:
4466
+ * console.log(result);
4467
+ * // Output:
4116
4468
  * // [
4117
4469
  * // {
4118
- * // key: "my_stream",
4119
- * // value: {
4120
- * // "1526984818136-0": [["duration", "1532"], ["event-id", "5"], ["user-id", "7782813"]],
4470
+ * // key: "my_stream", // Stream key
4471
+ * // value: { // Stream Ids mapped to entries array.
4472
+ * // "1526984818136-0": [["duration", "1532"], ["event-id", "5"], ["user-id", "7782813"]], // Each entry is a key/value tuple.
4121
4473
  * // "1526999352406-0": [["duration", "812"], ["event-id", "9"], ["user-id", "388234"]],
4122
4474
  * // }
4123
4475
  * // },
@@ -4155,7 +4507,8 @@ class BaseClient {
4155
4507
  * @example
4156
4508
  * ```typescript
4157
4509
  * const streamResults = await client.xreadgroup("my_group", "my_consumer", {"my_stream": "0-0", "writers_stream": "0-0", "readers_stream", ">"});
4158
- * console.log(result); // Output:
4510
+ * console.log(result);
4511
+ * // Output:
4159
4512
  * // [
4160
4513
  * // {
4161
4514
  * // key: "my_stream",
@@ -4197,7 +4550,9 @@ class BaseClient {
4197
4550
  * @example
4198
4551
  * ```typescript
4199
4552
  * const numEntries = await client.xlen("my_stream");
4200
- * console.log(numEntries); // Output: 2 - "my_stream" contains 2 entries.
4553
+ * console.log(numEntries);
4554
+ * // Output: 2
4555
+ * // `my_stream` contains 2 entries.
4201
4556
  * ```
4202
4557
  */
4203
4558
  async xlen(key) {
@@ -4213,7 +4568,8 @@ class BaseClient {
4213
4568
  * @returns An `array` that includes the summary of the pending messages. See example for more details.
4214
4569
  * @example
4215
4570
  * ```typescript
4216
- * console.log(await client.xpending("my_stream", "my_group")); // Output:
4571
+ * console.log(await client.xpending("my_stream", "my_group"));
4572
+ * // Output:
4217
4573
  * // [
4218
4574
  * // 42, // The total number of pending messages
4219
4575
  * // "1722643465939-0", // The smallest ID among the pending messages
@@ -4245,7 +4601,8 @@ class BaseClient {
4245
4601
  * end: InfBoundary.PositiveInfinity,
4246
4602
  * count: 2,
4247
4603
  * consumer: "consumer1"
4248
- * }); // Output:
4604
+ * });
4605
+ * // Output:
4249
4606
  * // [
4250
4607
  * // [
4251
4608
  * // "1722643465939-0", // The ID of the message
@@ -4280,13 +4637,14 @@ class BaseClient {
4280
4637
  * @example
4281
4638
  * ```typescript
4282
4639
  * const result = await client.xinfoConsumers("my_stream", "my_group");
4283
- * console.log(result); // Output:
4640
+ * console.log(result);
4641
+ * // Output:
4284
4642
  * // [
4285
4643
  * // {
4286
- * // "name": "Alice",
4287
- * // "pending": 1,
4288
- * // "idle": 9104628,
4289
- * // "inactive": 18104698 // Added in 7.2.0
4644
+ * // "name": "Alice", // The consumer name.
4645
+ * // "pending": 1, // The number of entries in Pending entries list.
4646
+ * // "idle": 9104628, // The time passed since last attempted interaction.
4647
+ * // "inactive": 18104698 // The time passed since last successful interaction. Added in Valkey 7.2.0.
4290
4648
  * // },
4291
4649
  * // ...
4292
4650
  * // ]
@@ -4307,23 +4665,24 @@ class BaseClient {
4307
4665
  * @example
4308
4666
  * ```typescript
4309
4667
  * const result = await client.xinfoGroups("my_stream");
4310
- * console.log(result); // Output:
4668
+ * console.log(result);
4669
+ * // Output:
4311
4670
  * // [
4312
4671
  * // {
4313
- * // "name": "mygroup",
4314
- * // "consumers": 2,
4315
- * // "pending": 2,
4316
- * // "last-delivered-id": "1638126030001-0",
4317
- * // "entries-read": 2, // Added in version 7.0.0
4318
- * // "lag": 0 // Added in version 7.0.0
4672
+ * // "name": "mygroup", // The consumer group name.
4673
+ * // "consumers": 2, // Number of consumers in the group.
4674
+ * // "pending": 2, // The length of the group's pending entry list.
4675
+ * // "last-delivered-id": "1638126030001-0", // The id of the last delivered entry to the consumers.
4676
+ * // "entries-read": 2, // The read counter. Added in Valkey 7.0.0.
4677
+ * // "lag": 0 // The number of entries that are still waiting to be delivered. Added in Valkey 7.0.0.
4319
4678
  * // },
4320
4679
  * // {
4321
4680
  * // "name": "some-other-group",
4322
4681
  * // "consumers": 1,
4323
4682
  * // "pending": 0,
4324
4683
  * // "last-delivered-id": "0-0",
4325
- * // "entries-read": null, // Added in version 7.0.0
4326
- * // "lag": 1 // Added in version 7.0.0
4684
+ * // "entries-read": null, // Added in Valkey 7.0.0.
4685
+ * // "lag": 1 // Added in Valkey 7.0.0.
4327
4686
  * // }
4328
4687
  * // ]
4329
4688
  * ```
@@ -4348,9 +4707,14 @@ class BaseClient {
4348
4707
  * ```typescript
4349
4708
  * const result = await client.xclaim("myStream", "myGroup", "myConsumer", 42,
4350
4709
  * ["1-0", "2-0", "3-0"], { idle: 500, retryCount: 3, isForce: true });
4351
- * console.log(result); // Output:
4710
+ * console.log(result);
4711
+ * // Output:
4352
4712
  * // {
4353
- * // "2-0": [["duration", "1532"], ["event-id", "5"], ["user-id", "7782813"]]
4713
+ * // "2-0": [ // Stream Entry id
4714
+ * // ["duration", "1532"], // Entry data tuple containing the field and associated value.
4715
+ * // ["event-id", "5"],
4716
+ * // ["user-id", "7782813"]
4717
+ * // ]
4354
4718
  * // }
4355
4719
  * ```
4356
4720
  */
@@ -4384,7 +4748,8 @@ class BaseClient {
4384
4748
  * @example
4385
4749
  * ```typescript
4386
4750
  * const result = await client.xautoclaim("myStream", "myGroup", "myConsumer", 42, "0-0", { count: 25 });
4387
- * console.log(result); // Output:
4751
+ * console.log(result);
4752
+ * // Output:
4388
4753
  * // [
4389
4754
  * // "1609338788321-0", // value to be used as `start` argument
4390
4755
  * // // for the next `xautoclaim` call
@@ -4432,7 +4797,8 @@ class BaseClient {
4432
4797
  * @example
4433
4798
  * ```typescript
4434
4799
  * const result = await client.xautoclaim("myStream", "myGroup", "myConsumer", 42, "0-0", { count: 25 });
4435
- * console.log(result); // Output:
4800
+ * console.log(result);
4801
+ * // Output:
4436
4802
  * // [
4437
4803
  * // "1609338788321-0", // value to be used as `start` argument
4438
4804
  * // // for the next `xautoclaim` call
@@ -4468,7 +4834,9 @@ class BaseClient {
4468
4834
  * ```typescript
4469
4835
  * const result = await client.xclaimJustId("my_stream", "my_group", "my_consumer", 42,
4470
4836
  * ["1-0", "2-0", "3-0"], { idle: 500, retryCount: 3, isForce: true });
4471
- * console.log(result); // Output: [ "2-0", "3-0" ]
4837
+ * console.log(result);
4838
+ * // Output: [ "2-0", "3-0" ]
4839
+ * // A list of entry ids.
4472
4840
  * ```
4473
4841
  */
4474
4842
  async xclaimJustId(key, group, consumer, minIdleTime, ids, options) {
@@ -4488,7 +4856,8 @@ class BaseClient {
4488
4856
  * @example
4489
4857
  * ```typescript
4490
4858
  * // Create the consumer group "mygroup", using zero as the starting ID:
4491
- * console.log(await client.xgroupCreate("mystream", "mygroup", "0-0")); // Output is "OK"
4859
+ * console.log(await client.xgroupCreate("mystream", "mygroup", "0-0"));
4860
+ * // Output: "OK"
4492
4861
  * ```
4493
4862
  */
4494
4863
  async xgroupCreate(key, groupName, id, options) {
@@ -4506,7 +4875,8 @@ class BaseClient {
4506
4875
  * @example
4507
4876
  * ```typescript
4508
4877
  * // Destroys the consumer group "mygroup"
4509
- * console.log(await client.xgroupDestroy("mystream", "mygroup")); // Output is true
4878
+ * console.log(await client.xgroupDestroy("mystream", "mygroup"));
4879
+ * // Output: true
4510
4880
  * ```
4511
4881
  */
4512
4882
  async xgroupDestroy(key, groupName) {
@@ -4522,6 +4892,7 @@ class BaseClient {
4522
4892
  * - (Optional) `fullOptions`: If `true`, returns verbose information with a limit of the first 10 PEL entries.
4523
4893
  * If `number` is specified, returns verbose information limiting the returned PEL entries.
4524
4894
  * If `0` is specified, returns verbose information with no limit.
4895
+ * @remark `fullOptions` - Available since Valkey version 6.0.0
4525
4896
  * - (Optional) `decoder`: see {@link DecoderOption}.
4526
4897
  * @returns A {@link ReturnTypeXinfoStream} of detailed stream information for the given `key`. See
4527
4898
  * the example for a sample response.
@@ -4531,46 +4902,46 @@ class BaseClient {
4531
4902
  * const infoResult = await client.xinfoStream("my_stream");
4532
4903
  * console.log(infoResult);
4533
4904
  * // Output: {
4534
- * // length: 2,
4535
- * // "radix-tree-keys": 1,
4536
- * // "radix-tree-nodes": 2,
4537
- * // "last-generated-id": "1719877599564-1",
4538
- * // "max-deleted-entry-id": "0-0",
4539
- * // "entries-added": 2,
4540
- * // "recorded-first-entry-id": "1719877599564-0",
4541
- * // "first-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
4542
- * // "last-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ],
4543
- * // groups: 1,
4905
+ * // length: 2, // The number of entries in the stream.
4906
+ * // "radix-tree-keys": 1, // The number of keys in the underlying radix data structure.
4907
+ * // "radix-tree-nodes": 2, // The number of nodes in the underlying radix data structure.
4908
+ * // "last-generated-id": "1719877599564-1", // The ID of the least-recently entry that was added to the stream.
4909
+ * // "max-deleted-entry-id": "0-0", // The maximal entry ID that was deleted from the stream. Added in Valkey 7.0.0.
4910
+ * // "entries-added": 2, // The count of all entries added to the stream during its lifetime. Added in Valkey 7.0.0.
4911
+ * // "recorded-first-entry-id": "1719877599564-0", // Recorded first entry id. Added in Valkey 7.0.0.
4912
+ * // "first-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ], // The ID and field-value tuples of the first entry in the stream.
4913
+ * // "last-entry": [ "1719877599564-0", ["some_field", "some_value", ...] ], // The ID and field-value tuples of the last entry in the stream.
4914
+ * // "groups": 1, // The number of consumer groups defined for the stream
4544
4915
  * // }
4545
4916
  * ```
4546
4917
  *
4547
4918
  * @example
4548
4919
  * ```typescript
4549
4920
  * const infoResult = await client.xinfoStream("my_stream", true); // default limit of 10 entries
4550
- * const infoResult = await client.xinfoStream("my_stream", 15); // limit of 15 entries
4921
+ * const infoResult = await client.xinfoStream("my_stream", 15); // limit of 15 entries
4551
4922
  * console.log(infoResult);
4552
4923
  * // Output: {
4553
- * // "length": 2,
4554
- * // "radix-tree-keys": 1,
4555
- * // "radix-tree-nodes": 2,
4556
- * // "last-generated-id": "1719877599564-1",
4557
- * // "max-deleted-entry-id": "0-0",
4558
- * // "entries-added": 2,
4559
- * // "recorded-first-entry-id": "1719877599564-0",
4560
- * // "entries": [ [ "1719877599564-0", ["some_field", "some_value", ...] ] ],
4561
- * // "groups': [ {
4562
- * // "name': "group",
4563
- * // "last-delivered-id": "1719877599564-0",
4564
- * // "entries-read": 1,
4565
- * // "lag": 1,
4566
- * // "pel-count": 1,
4567
- * // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ],
4924
+ * // "length": 2, // The number of entries in the stream.
4925
+ * // "radix-tree-keys": 1, // The number of keys in the underlying radix data structure.
4926
+ * // "radix-tree-nodes": 2, // The number of nodes in the underlying radix data structure.
4927
+ * // "last-generated-id": "1719877599564-1", // The ID of the least-recently entry that was added to the stream.
4928
+ * // "max-deleted-entry-id": "0-0", // The maximal entry ID that was deleted from the stream. Added in Valkey 7.0.0.
4929
+ * // "entries-added": 2, // The count of all entries added to the stream during its lifetime. Added in Valkey 7.0.0.
4930
+ * // "recorded-first-entry-id": "1719877599564-0", // Recorded first entry id. Added in Valkey 7.0.0.
4931
+ * // "entries": [ [ "1719877599564-0", ["some_field", "some_value", ...] ] ], // Array of the stream entries (ID and field-value tuples) in ascending order.
4932
+ * // "groups': [ { // An array of groups containing information about each consumer group.
4933
+ * // "name': "group", // The consumer group's name.
4934
+ * // "last-delivered-id": "1719877599564-0", // The ID of the last entry delivered to the group's consumers.
4935
+ * // "entries-read": 1, // The logical "read counter" of the last entry delivered to the group's consumers. Added in Valkey 7.0.0.
4936
+ * // "lag": 1, // The number of entries in the stream that are still waiting to be delivered. Added in Valkey 7.0.0.
4937
+ * // "pel-count": 1, // The length of the group's pending entries list (PEL).
4938
+ * // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ], // An array with pending entries.
4568
4939
  * // "consumers": [ {
4569
- * // "name": "consumer",
4570
- * // "seen-time": 1722624726802,
4571
- * // "active-time": 1722624726802,
4572
- * // "pel-count": 1,
4573
- * // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ],
4940
+ * // "name": "consumer", // The consumer's name.
4941
+ * // "seen-time": 1722624726802, // The UNIX timestamp of the last attempted interaction.
4942
+ * // "active-time": 1722624726802, // The UNIX timestamp of the last successful interaction. Added in Valkey 7.2.0.
4943
+ * // "pel-count": 1, // The number of entries in the PEL.
4944
+ * // "pending": [ [ "1719877599564-0", "consumer", 1722624726802, 1 ] ], // An array with pending entries information.
4574
4945
  * // }
4575
4946
  * // ]
4576
4947
  * // }
@@ -4594,7 +4965,8 @@ class BaseClient {
4594
4965
  * @example
4595
4966
  * ```typescript
4596
4967
  * // The consumer "myconsumer" was created in consumer group "mygroup" for the stream "mystream".
4597
- * console.log(await client.xgroupCreateConsumer("mystream", "mygroup", "myconsumer")); // Output is true
4968
+ * console.log(await client.xgroupCreateConsumer("mystream", "mygroup", "myconsumer"));
4969
+ * // Output: true
4598
4970
  * ```
4599
4971
  */
4600
4972
  async xgroupCreateConsumer(key, groupName, consumerName) {
@@ -4613,7 +4985,8 @@ class BaseClient {
4613
4985
  * * @example
4614
4986
  * ```typescript
4615
4987
  * // Consumer "myconsumer" was deleted, and had 5 pending messages unclaimed.
4616
- * console.log(await client.xgroupDelConsumer("mystream", "mygroup", "myconsumer")); // Output is 5
4988
+ * console.log(await client.xgroupDelConsumer("mystream", "mygroup", "myconsumer"));
4989
+ * // Output: 5
4617
4990
  * ```
4618
4991
  */
4619
4992
  async xgroupDelConsumer(key, groupName, consumerName) {
@@ -4642,7 +5015,8 @@ class BaseClient {
4642
5015
  * // read messages from streamId
4643
5016
  * const readResult = await client.xreadgroup(["myfield", "mydata"], "mygroup", "my0consumer");
4644
5017
  * // acknowledge messages on stream
4645
- * console.log(await client.xack("mystream", "mygroup", [entryId])); // Output: 1
5018
+ * console.log(await client.xack("mystream", "mygroup", [entryId]));
5019
+ * // Output: 1
4646
5020
  * ```
4647
5021
  */
4648
5022
  async xack(key, group, ids) {
@@ -4663,7 +5037,8 @@ class BaseClient {
4663
5037
  *
4664
5038
  * * @example
4665
5039
  * ```typescript
4666
- * console.log(await client.xgroupSetId("mystream", "mygroup", "0", { entriesRead: 1 })); // Output is "OK"
5040
+ * console.log(await client.xgroupSetId("mystream", "mygroup", "0", { entriesRead: 1 }));
5041
+ * // Output: "OK"
4667
5042
  * ```
4668
5043
  */
4669
5044
  async xgroupSetId(key, groupName, id, options) {
@@ -4686,14 +5061,18 @@ class BaseClient {
4686
5061
  * ```typescript
4687
5062
  * // Example usage of lindex method to retrieve elements from a list by index
4688
5063
  * const result = await client.lindex("my_list", 0);
4689
- * console.log(result); // Output: 'value1' - Returns the first element in the list stored at 'my_list'.
5064
+ * console.log(result);
5065
+ * // Output: 'value1'
5066
+ * // Returns the first element in the list stored at `my_list`.
4690
5067
  * ```
4691
5068
  *
4692
5069
  * @example
4693
5070
  * ```typescript
4694
5071
  * // Example usage of lindex method to retrieve elements from a list by negative index
4695
5072
  * const result = await client.lindex("my_list", -1);
4696
- * console.log(result); // Output: 'value3' - Returns the last element in the list stored at 'my_list'.
5073
+ * console.log(result);
5074
+ * // Output: 'value3'
5075
+ * // Returns the last element in the list stored at `my_list`.
4697
5076
  * ```
4698
5077
  */
4699
5078
  async lindex(key, index, options) {
@@ -4716,7 +5095,9 @@ class BaseClient {
4716
5095
  * @example
4717
5096
  * ```typescript
4718
5097
  * const length = await client.linsert("my_list", InsertPosition.Before, "World", "There");
4719
- * console.log(length); // Output: 2 - The list has a length of 2 after performing the insert.
5098
+ * console.log(length);
5099
+ * // Output: 2
5100
+ * // The list has a length of 2 after performing the insert.
4720
5101
  * ```
4721
5102
  */
4722
5103
  async linsert(key, position, pivot, element) {
@@ -4735,7 +5116,9 @@ class BaseClient {
4735
5116
  * ```typescript
4736
5117
  * // Example usage of persist method to remove the timeout associated with a key
4737
5118
  * const result = await client.persist("my_key");
4738
- * console.log(result); // Output: true - Indicates that the timeout associated with the key "my_key" was successfully removed.
5119
+ * console.log(result);
5120
+ * // Output: true
5121
+ * // Indicates that the timeout associated with the key `my_key` was successfully removed.
4739
5122
  * ```
4740
5123
  */
4741
5124
  async persist(key) {
@@ -4757,7 +5140,9 @@ class BaseClient {
4757
5140
  * // Example usage of rename method to rename a key
4758
5141
  * await client.set("old_key", "value");
4759
5142
  * const result = await client.rename("old_key", "new_key");
4760
- * console.log(result); // Output: OK - Indicates successful renaming of the key "old_key" to "new_key".
5143
+ * console.log(result);
5144
+ * // Output: OK
5145
+ * // Indicates successful renaming of the key `old_key` to `new_key`.
4761
5146
  * ```
4762
5147
  */
4763
5148
  async rename(key, newKey) {
@@ -4781,7 +5166,9 @@ class BaseClient {
4781
5166
  * // Example usage of renamenx method to rename a key
4782
5167
  * await client.set("old_key", "value");
4783
5168
  * const result = await client.renamenx("old_key", "new_key");
4784
- * console.log(result); // Output: true - Indicates successful renaming of the key "old_key" to "new_key".
5169
+ * console.log(result);
5170
+ * // Output: true
5171
+ * // Indicates successful renaming of the key `old_key` to `new_key`.
4785
5172
  * ```
4786
5173
  */
4787
5174
  async renamenx(key, newKey) {
@@ -4806,7 +5193,9 @@ class BaseClient {
4806
5193
  * ```typescript
4807
5194
  * // Example usage of brpop method to block and wait for elements from multiple lists
4808
5195
  * const result = await client.brpop(["list1", "list2"], 5);
4809
- * console.log(result); // Output: ["list1", "element"] - Indicates an element "element" was popped from "list1".
5196
+ * console.log(result);
5197
+ * // Output: ["list1", "element"]
5198
+ * // Indicates an element `element` was popped from `list1`.
4810
5199
  * ```
4811
5200
  */
4812
5201
  async brpop(keys, timeout, options) {
@@ -4830,7 +5219,9 @@ class BaseClient {
4830
5219
  * @example
4831
5220
  * ```typescript
4832
5221
  * const result = await client.blpop(["list1", "list2"], 5);
4833
- * console.log(result); // Output: ['list1', 'element']
5222
+ * console.log(result);
5223
+ * // Output: ['list1', 'element']
5224
+ * // An element `element` popped from the list stored at key `list1`.
4834
5225
  * ```
4835
5226
  */
4836
5227
  async blpop(keys, timeout, options) {
@@ -4849,9 +5240,14 @@ class BaseClient {
4849
5240
  * @example
4850
5241
  * ```typescript
4851
5242
  * const result = await client.pfadd("hll_1", ["a", "b", "c"]);
4852
- * console.log(result); // Output: true - Indicates that a data structure was created or modified
5243
+ * console.log(result);
5244
+ * // Output: true
5245
+ * // Indicates that a data structure was created or modified.
5246
+ *
4853
5247
  * const result = await client.pfadd("hll_2", []);
4854
- * console.log(result); // Output: true - Indicates that a new empty data structure was created
5248
+ * console.log(result);
5249
+ * // Output: true
5250
+ * // Indicates that a new empty data structure was created.
4855
5251
  * ```
4856
5252
  */
4857
5253
  async pfadd(key, elements) {
@@ -4869,7 +5265,9 @@ class BaseClient {
4869
5265
  * @example
4870
5266
  * ```typescript
4871
5267
  * const result = await client.pfcount(["hll_1", "hll_2"]);
4872
- * console.log(result); // Output: 4 - The approximated cardinality of the union of "hll_1" and "hll_2"
5268
+ * console.log(result);
5269
+ * // Output: 4
5270
+ * // The approximate cardinality of the union of `hll_1` and `hll_2`
4873
5271
  * ```
4874
5272
  */
4875
5273
  async pfcount(keys) {
@@ -4891,9 +5289,14 @@ class BaseClient {
4891
5289
  * await client.pfadd("hll1", ["a", "b"]);
4892
5290
  * await client.pfadd("hll2", ["b", "c"]);
4893
5291
  * const result = await client.pfmerge("new_hll", ["hll1", "hll2"]);
4894
- * console.log(result); // Output: OK - The value of "hll1" merged with "hll2" was stored in "new_hll".
5292
+ * console.log(result);
5293
+ * // Output: OK
5294
+ * // The value of `hll1` merged with `hll2` was stored in `new_hll`.
5295
+ *
4895
5296
  * const count = await client.pfcount(["new_hll"]);
4896
- * console.log(count); // Output: 3 - The approximated cardinality of "new_hll" is 3.
5297
+ * console.log(count);
5298
+ * // Output: 3
5299
+ * // The approximate cardinality of `new_hll` is 3.
4897
5300
  * ```
4898
5301
  */
4899
5302
  async pfmerge(destination, sourceKeys) {
@@ -4913,7 +5316,8 @@ class BaseClient {
4913
5316
  * @example
4914
5317
  * ```typescript
4915
5318
  * const result = await client.objectEncoding("my_hash");
4916
- * console.log(result); // Output: "listpack"
5319
+ * console.log(result);
5320
+ * // Output: "listpack"
4917
5321
  * ```
4918
5322
  */
4919
5323
  async objectEncoding(key) {
@@ -4933,7 +5337,9 @@ class BaseClient {
4933
5337
  * @example
4934
5338
  * ```typescript
4935
5339
  * const result = await client.objectFreq("my_hash");
4936
- * console.log(result); // Output: 2 - The logarithmic access frequency counter of "my_hash".
5340
+ * console.log(result);
5341
+ * // Output: 2
5342
+ * // The logarithmic access frequency counter of `my_hash`.
4937
5343
  * ```
4938
5344
  */
4939
5345
  async objectFreq(key) {
@@ -4950,7 +5356,9 @@ class BaseClient {
4950
5356
  * @example
4951
5357
  * ```typescript
4952
5358
  * const result = await client.objectIdletime("my_hash");
4953
- * console.log(result); // Output: 13 - "my_hash" was last accessed 13 seconds ago.
5359
+ * console.log(result);
5360
+ * // Output: 13
5361
+ * // `my_hash` was last accessed 13 seconds ago.
4954
5362
  * ```
4955
5363
  */
4956
5364
  async objectIdletime(key) {
@@ -4968,7 +5376,9 @@ class BaseClient {
4968
5376
  * @example
4969
5377
  * ```typescript
4970
5378
  * const result = await client.objectRefcount("my_hash");
4971
- * console.log(result); // Output: 2 - "my_hash" has a reference count of 2.
5379
+ * console.log(result);
5380
+ * // Output: 2
5381
+ * // `my_hash` has a reference count of 2.
4972
5382
  * ```
4973
5383
  */
4974
5384
  async objectRefcount(key) {
@@ -4991,7 +5401,7 @@ class BaseClient {
4991
5401
  * @example
4992
5402
  * ```typescript
4993
5403
  * const response = await client.fcall("Deep_Thought", [], []);
4994
- * console.log(response); // Output: Returns the function's return value.
5404
+ * console.log(response); // Returns the function's return value.
4995
5405
  * ```
4996
5406
  */
4997
5407
  async fcall(func, keys, args, options) {
@@ -5015,7 +5425,9 @@ class BaseClient {
5015
5425
  * ```typescript
5016
5426
  * const response = await client.fcallReadOnly("Deep_Thought", ["key1"], ["Answer", "to", "the",
5017
5427
  * "Ultimate", "Question", "of", "Life,", "the", "Universe,", "and", "Everything"]);
5018
- * console.log(response); // Output: 42 # The return value on the function that was executed.
5428
+ * console.log(response);
5429
+ * // Output: 42
5430
+ * // The return value on the function that was executed.
5019
5431
  * ```
5020
5432
  */
5021
5433
  async fcallReadonly(func, keys, args, options) {
@@ -5038,8 +5450,13 @@ class BaseClient {
5038
5450
  * @example
5039
5451
  * ```typescript
5040
5452
  * await client.rpush("myList", ["a", "b", "c", "d", "e", "e"]);
5041
- * console.log(await client.lpos("myList", "e", { rank: 2 })); // Output: 5 - the second occurrence of "e" is at index 5.
5042
- * console.log(await client.lpos("myList", "e", { count: 3 })); // Output: [ 4, 5 ] - indices for the occurrences of "e" in list "myList".
5453
+ * console.log(await client.lpos("myList", "e", { rank: 2 }));
5454
+ * // Output: 5
5455
+ * // The second occurrence of `e` is at index 5.
5456
+ *
5457
+ * console.log(await client.lpos("myList", "e", { count: 3 }));
5458
+ * // Output: [ 4, 5 ]
5459
+ * // indices for the occurrences of `e` in list `myList`.
5043
5460
  * ```
5044
5461
  */
5045
5462
  async lpos(key, element, options) {
@@ -5059,11 +5476,25 @@ class BaseClient {
5059
5476
  *
5060
5477
  * @example
5061
5478
  * ```typescript
5062
- * console.log(await client.bitcount("my_key1")); // Output: 2 - The string stored at "my_key1" contains 2 set bits.
5063
- * console.log(await client.bitcount("my_key2", { start: 1 })); // Output: 8 - From the second to to the last bytes of the string stored at "my_key2" are contain 8 set bits.
5064
- * console.log(await client.bitcount("my_key2", { start: 1, end: 3 })); // Output: 2 - The second to fourth bytes of the string stored at "my_key2" contain 2 set bits.
5065
- * console.log(await client.bitcount("my_key3", { start: 1, end: 1, indexType: BitmapIndexType.BIT })); // Output: 1 - Indicates that the second bit of the string stored at "my_key3" is set.
5066
- * console.log(await client.bitcount("my_key3", { start: -1, end: -1, indexType: BitmapIndexType.BIT })); // Output: 1 - Indicates that the last bit of the string stored at "my_key3" is set.
5479
+ * console.log(await client.bitcount("my_key1"));
5480
+ * // Output: 2
5481
+ * // The string stored at `my_key1` contains 2 set bits.
5482
+ *
5483
+ * console.log(await client.bitcount("my_key2", { start: 1 }));
5484
+ * // Output: 8
5485
+ * // From the second to to the last bytes of the string stored at `my_key2` are contain 8 set bits.
5486
+ *
5487
+ * console.log(await client.bitcount("my_key2", { start: 1, end: 3 }));
5488
+ * // Output: 2
5489
+ * // The second to fourth bytes of the string stored at `my_key2` contain 2 set bits.
5490
+ *
5491
+ * console.log(await client.bitcount("my_key3", { start: 1, end: 1, indexType: BitmapIndexType.BIT }));
5492
+ * // Output: 1
5493
+ * // Indicates that the second bit of the string stored at `my_key3` is set.
5494
+ *
5495
+ * console.log(await client.bitcount("my_key3", { start: -1, end: -1, indexType: BitmapIndexType.BIT }));
5496
+ * // Output: 1
5497
+ * // Indicates that the last bit of the string stored at `my_key3` is set.
5067
5498
  * ```
5068
5499
  */
5069
5500
  async bitcount(key, options) {
@@ -5090,7 +5521,9 @@ class BaseClient {
5090
5521
  * ["Palermo", { longitude: 13.361389, latitude: 38.115556 }],
5091
5522
  * ]);
5092
5523
  * const num = await client.geoadd("mySortedSet", membersToCoordinates, options);
5093
- * console.log(num); // Output: 1 - Indicates that the position of an existing member in the sorted set "mySortedSet" has been updated.
5524
+ * console.log(num);
5525
+ * // Output: 1
5526
+ * // Indicates that the position of an existing member in the sorted set `mySortedSet` has been updated.
5094
5527
  * ```
5095
5528
  */
5096
5529
  async geoadd(key, membersToGeospatialData, options) {
@@ -5126,7 +5559,9 @@ class BaseClient {
5126
5559
  * await client.geoadd("mySortedSet", data);
5127
5560
  * // search for locations within 200 km circle around stored member named 'Palermo'
5128
5561
  * const result1 = await client.geosearch("mySortedSet", { member: "Palermo" }, { radius: 200, unit: GeoUnit.KILOMETERS });
5129
- * console.log(result1); // Output: ['Palermo', 'Catania']
5562
+ * console.log(result1);
5563
+ * // Output: ['Palermo', 'Catania']
5564
+ * // Locations within the specified radius.
5130
5565
  *
5131
5566
  * // search for locations in 200x300 mi rectangle centered at coordinate (15, 37), requesting additional info,
5132
5567
  * // limiting results by 2 best matches, ordered by ascending distance from the search area center
@@ -5142,7 +5577,8 @@ class BaseClient {
5142
5577
  * withHash: true,
5143
5578
  * },
5144
5579
  * );
5145
- * console.log(result2); // Output:
5580
+ * console.log(result2);
5581
+ * // Output:
5146
5582
  * // [
5147
5583
  * // [
5148
5584
  * // 'Catania', // location name
@@ -5198,7 +5634,8 @@ class BaseClient {
5198
5634
  * await client.geosearchstore("destination", "mySortedSet", { member: "Palermo" }, { radius: 200, unit: GeoUnit.KILOMETERS });
5199
5635
  * // query the stored results
5200
5636
  * const result1 = await client.zrangeWithScores("destination", { start: 0, end: -1 });
5201
- * console.log(result1); // Output:
5637
+ * console.log(result1);
5638
+ * // Output:
5202
5639
  * // {
5203
5640
  * // Palermo: 3479099956230698, // geohash of the location is stored as element's score
5204
5641
  * // Catania: 3479447370796909
@@ -5219,7 +5656,8 @@ class BaseClient {
5219
5656
  * );
5220
5657
  * // query the stored results
5221
5658
  * const result2 = await client.zrangeWithScores("destination", { start: 0, end: -1 });
5222
- * console.log(result2); // Output:
5659
+ * console.log(result2);
5660
+ * // Output:
5223
5661
  * // {
5224
5662
  * // Palermo: 190.4424, // distance from the search area center is stored as element's score
5225
5663
  * // Catania: 56.4413, // the distance is measured in units used for the search query (miles)
@@ -5248,11 +5686,12 @@ class BaseClient {
5248
5686
  * const result = await client.geopos("mySortedSet", ["Palermo", "Catania", "NonExisting"]);
5249
5687
  * // When added via GEOADD, the geospatial coordinates are converted into a 52 bit geohash, so the coordinates
5250
5688
  * // returned might not be exactly the same as the input values
5251
- * console.log(result); // Output:
5689
+ * console.log(result);
5690
+ * // Output:
5252
5691
  * // [
5253
- * // [13.36138933897018433, 38.11555639549629859],
5254
- * // [15.08726745843887329, 37.50266842333162032],
5255
- * // null
5692
+ * // [13.36138933897018433, 38.11555639549629859], // Returns the position of member `Palermo`
5693
+ * // [15.08726745843887329, 37.50266842333162032], // Returns the position of member `Catania`
5694
+ * // null // Returns null for non existent key.
5256
5695
  * // ]
5257
5696
  * ```
5258
5697
  */
@@ -5283,11 +5722,11 @@ class BaseClient {
5283
5722
  * await client.zadd("zSet2", { four: 4.0 });
5284
5723
  * console.log(await client.zmpop(["zSet1", "zSet2"], ScoreFilter.MAX, 2));
5285
5724
  * // Output:
5286
- * // "three" with score 3 and "two" with score 2 were popped from "zSet1"
5287
5725
  * // [ "zSet1", [
5288
5726
  * // { element: 'three', score: 3 },
5289
5727
  * // { element: 'two', score: 2 }
5290
5728
  * // ] ]
5729
+ * // `three` with score 3 and `two` with score 2 were popped from `zSet1`.
5291
5730
  * ```
5292
5731
  */
5293
5732
  async zmpop(keys, modifier, options) {
@@ -5323,11 +5762,11 @@ class BaseClient {
5323
5762
  * await client.zadd("zSet2", { four: 4.0 });
5324
5763
  * console.log(await client.bzmpop(["zSet1", "zSet2"], ScoreFilter.MAX, 0.1, 2));
5325
5764
  * // Output:
5326
- * // "three" with score 3 and "two" with score 2 were popped from "zSet1"
5327
5765
  * // [ "zSet1", [
5328
5766
  * // { element: 'three', score: 3 },
5329
5767
  * // { element: 'two', score: 2 }
5330
5768
  * // ] ]
5769
+ * // `three` with score 3 and `two` with score 2 were popped from `zSet1`
5331
5770
  * ```
5332
5771
  */
5333
5772
  async bzmpop(keys, modifier, timeout, options) {
@@ -5352,12 +5791,18 @@ class BaseClient {
5352
5791
  * ```typescript
5353
5792
  * // Example usage of zincrBy method to increment the value of a member's score
5354
5793
  * await client.zadd("my_sorted_set", {"member": 10.5, "member2": 8.2});
5794
+ *
5355
5795
  * console.log(await client.zincrby("my_sorted_set", 1.2, "member"));
5356
- * // Output: 11.7 - The member existed in the set before score was altered, the new score is 11.7.
5796
+ * // Output: 11.7
5797
+ * // The member existed in the set before score was altered, the new score is 11.7.
5798
+ *
5357
5799
  * console.log(await client.zincrby("my_sorted_set", -1.7, "member"));
5358
- * // Output: 10.0 - Negative increment, decrements the score.
5800
+ * // Output: 10.0
5801
+ * // Negative increment, decrements the score.
5802
+ *
5359
5803
  * console.log(await client.zincrby("my_sorted_set", 5.5, "non_existing_member"));
5360
- * // Output: 5.5 - A new member is added to the sorted set with the score of 5.5.
5804
+ * // Output: 5.5
5805
+ * // A new member is added to the sorted set with the score of 5.5.
5361
5806
  * ```
5362
5807
  */
5363
5808
  async zincrby(key, increment, member) {
@@ -5446,7 +5891,8 @@ class BaseClient {
5446
5891
  * @example
5447
5892
  * ```typescript
5448
5893
  * const result = await client.geodist("mySortedSet", "Place1", "Place2", { unit: GeoUnit.KILOMETERS });
5449
- * console.log(num); // Output: the distance between Place1 and Place2.
5894
+ * console.log(num);
5895
+ * // Output: the distance between Place1 and Place2.
5450
5896
  * ```
5451
5897
  */
5452
5898
  async geodist(key, member1, member2, options) {
@@ -5465,7 +5911,9 @@ class BaseClient {
5465
5911
  * @example
5466
5912
  * ```typescript
5467
5913
  * const result = await client.geohash("mySortedSet", ["Palermo", "Catania", "NonExisting"]);
5468
- * console.log(result); // Output: ["sqc8b49rny0", "sqdtr74hyu0", null]
5914
+ * console.log(result);
5915
+ * // Output: ["sqc8b49rny0", "sqdtr74hyu0", null]
5916
+ * // An array of GeoHash string.
5469
5917
  * ```
5470
5918
  */
5471
5919
  async geohash(key, members) {
@@ -5490,7 +5938,9 @@ class BaseClient {
5490
5938
  * ```typescript
5491
5939
  * await client.mset({"testKey1": "abcd", "testKey2": "axcd"});
5492
5940
  * const result = await client.lcs("testKey1", "testKey2");
5493
- * console.log(result); // Output: 'acd'
5941
+ * console.log(result);
5942
+ * // Output: 'acd'
5943
+ * // Returned the longest common subsequence of strings stored at `testKey1` and `testKey2`.
5494
5944
  * ```
5495
5945
  */
5496
5946
  async lcs(key1, key2, options) {
@@ -5512,7 +5962,9 @@ class BaseClient {
5512
5962
  * ```typescript
5513
5963
  * await client.mset({"testKey1": "abcd", "testKey2": "axcd"});
5514
5964
  * const result = await client.lcsLen("testKey1", "testKey2");
5515
- * console.log(result); // Output: 3
5965
+ * console.log(result);
5966
+ * // Output: 3
5967
+ * // The total length of all the longest common subsequences between the strings stored at `testKey1` and `testKey2`.
5516
5968
  * ```
5517
5969
  */
5518
5970
  async lcsLen(key1, key2, options) {
@@ -5546,7 +5998,8 @@ class BaseClient {
5546
5998
  * ```typescript
5547
5999
  * await client.mset({"key1": "ohmytext", "key2": "mynewtext"});
5548
6000
  * const result = await client.lcsIdx("key1", "key2");
5549
- * console.log(result); // Output:
6001
+ * console.log(result);
6002
+ * // Output:
5550
6003
  * {
5551
6004
  * "matches" :
5552
6005
  * [
@@ -5589,7 +6042,9 @@ class BaseClient {
5589
6042
  * await client.set("key1", "value1");
5590
6043
  * await client.set("key2", "value2");
5591
6044
  * const result = await client.touch(["key1", "key2", "nonExistingKey"]);
5592
- * console.log(result); // Output: 2 - The last access time of 2 keys has been updated.
6045
+ * console.log(result);
6046
+ * // Output: 2
6047
+ * // The last access time of 2 keys has been updated.
5593
6048
  * ```
5594
6049
  */
5595
6050
  async touch(keys) {
@@ -5616,18 +6071,27 @@ class BaseClient {
5616
6071
  * @example
5617
6072
  * ```typescript
5618
6073
  * const response = await client.watch(["sampleKey"]);
5619
- * console.log(response); // Output: "OK"
6074
+ * console.log(response);
6075
+ * // Output: "OK"
6076
+ *
5620
6077
  * const transaction = new Batch(true).set("SampleKey", "foobar");
5621
6078
  * const result = await client.exec(transaction);
5622
- * console.log(result); // Output: "OK" - Executes successfully and keys are unwatched.
6079
+ * console.log(result);
6080
+ *
6081
+ * // Output: "OK"
6082
+ * // Executes successfully and keys are unwatched.
5623
6083
  * ```
5624
6084
  * ```typescript
5625
6085
  * const response = await client.watch(["sampleKey"]);
5626
- * console.log(response); // Output: "OK"
6086
+ * console.log(response);
6087
+ * // Output: "OK"
6088
+ *
5627
6089
  * const transaction = new Batch(true).set("SampleKey", "foobar");
5628
6090
  * await client.set("sampleKey", "hello world");
5629
6091
  * const result = await client.exec(transaction);
5630
- * console.log(result); // Output: null - null is returned when the watched key is modified before transaction execution.
6092
+ * console.log(result);
6093
+ * // Output: null
6094
+ * // null is returned when the watched key is modified before transaction execution.
5631
6095
  * ```
5632
6096
  */
5633
6097
  async watch(keys) {
@@ -5650,7 +6114,8 @@ class BaseClient {
5650
6114
  * ```typescript
5651
6115
  * await client.set(key, value);
5652
6116
  * let response = await client.wait(1, 1000);
5653
- * console.log(response); // Output: return 1 when a replica is reached or 0 if 1000ms is reached.
6117
+ * console.log(response);
6118
+ * // Output: return 1 when a replica is reached or 0 if 1000ms is reached.
5654
6119
  * ```
5655
6120
  */
5656
6121
  async wait(numreplicas, timeout) {
@@ -5671,9 +6136,14 @@ class BaseClient {
5671
6136
  * @example
5672
6137
  * ```typescript
5673
6138
  * const len = await client.setrange("key", 6, "GLIDE");
5674
- * console.log(len); // Output: 11 - New key was created with length of 11 symbols
6139
+ * console.log(len);
6140
+ * // Output: 11
6141
+ * // New key was created with length of 11 symbols
6142
+ *
5675
6143
  * const value = await client.get("key");
5676
- * console.log(result); // Output: "\0\0\0\0\0\0GLIDE" - The string was padded with zero bytes
6144
+ * console.log(result);
6145
+ * // Output: "\0\0\0\0\0\0GLIDE"
6146
+ * // The string was padded with zero bytes
5677
6147
  * ```
5678
6148
  */
5679
6149
  async setrange(key, offset, value) {
@@ -5693,12 +6163,15 @@ class BaseClient {
5693
6163
  * ```typescript
5694
6164
  * const len = await client.append("key", "Hello");
5695
6165
  * console.log(len);
5696
- * // Output: 5 - Indicates that "Hello" has been appended to the value of "key", which was initially
5697
- * // empty, resulting in a new value of "Hello" with a length of 5 - similar to the set operation.
6166
+ * // Output: 5
6167
+ * // Indicates that "Hello" has been appended to the value of "key", which was initially
6168
+ * // empty, resulting in a new value of "Hello" with a length of 5 - similar to the set operation.
6169
+ *
5698
6170
  * len = await client.append("key", " world");
5699
6171
  * console.log(result);
5700
- * // Output: 11 - Indicates that " world" has been appended to the value of "key", resulting in a
5701
- * // new value of "Hello world" with a length of 11.
6172
+ * // Output: 11
6173
+ * // Indicates that " world" has been appended to the value of "key", resulting in a
6174
+ * // new value of "Hello world" with a length of 11.
5702
6175
  * ```
5703
6176
  */
5704
6177
  async append(key, value) {
@@ -5724,7 +6197,8 @@ class BaseClient {
5724
6197
  * await client.lpush("testKey", ["one", "two", "three"]);
5725
6198
  * await client.lpush("testKey2", ["five", "six", "seven"]);
5726
6199
  * const result = await client.lmpop(["testKey", "testKey2"], ListDirection.LEFT, 1L);
5727
- * console.log(result); // Output: { key: "testKey", elements: ["three"] }
6200
+ * console.log(result);
6201
+ * // Output: { key: "testKey", elements: ["three"] }
5728
6202
  * ```
5729
6203
  */
5730
6204
  async lmpop(keys, direction, options) {
@@ -5756,7 +6230,8 @@ class BaseClient {
5756
6230
  * await client.lpush("testKey", ["one", "two", "three"]);
5757
6231
  * await client.lpush("testKey2", ["five", "six", "seven"]);
5758
6232
  * const result = await client.blmpop(["testKey", "testKey2"], ListDirection.LEFT, 0.1, 1);
5759
- * console.log(result"testKey"); // Output: { key: "testKey", elements: ["three"] }
6233
+ * console.log(result"testKey");
6234
+ * // Output: { key: "testKey", elements: ["three"] }
5760
6235
  * ```
5761
6236
  */
5762
6237
  async blmpop(keys, direction, timeout, options) {
@@ -5782,10 +6257,12 @@ class BaseClient {
5782
6257
  * @example
5783
6258
  * ```typescript
5784
6259
  * const channels = await client.pubsubChannels();
5785
- * console.log(channels); // Output: ["channel1", "channel2"]
6260
+ * console.log(channels);
6261
+ * // Output: ["channel1", "channel2"]
5786
6262
  *
5787
6263
  * const newsChannels = await client.pubsubChannels("news.*");
5788
- * console.log(newsChannels); // Output: ["news.sports", "news.weather"]
6264
+ * console.log(newsChannels);
6265
+ * // Output: ["news.sports", "news.weather"]
5789
6266
  * ```
5790
6267
  */
5791
6268
  async pubsubChannels(options) {
@@ -5805,7 +6282,8 @@ class BaseClient {
5805
6282
  * @example
5806
6283
  * ```typescript
5807
6284
  * const patternCount = await client.pubsubNumpat();
5808
- * console.log(patternCount); // Output: 3
6285
+ * console.log(patternCount);
6286
+ * // Output: 3
5809
6287
  * ```
5810
6288
  */
5811
6289
  async pubsubNumPat() {
@@ -5824,11 +6302,12 @@ class BaseClient {
5824
6302
  * @example
5825
6303
  * ```typescript
5826
6304
  * const result1 = await client.pubsubNumsub(["channel1", "channel2"]);
5827
- * console.log(result1); // Output:
5828
- * // [{ channel: "channel1", numSub: 3}, { channel: "channel2", numSub: 5 }]
6305
+ * console.log(result1);
6306
+ * // Output: [{ channel: "channel1", numSub: 3}, { channel: "channel2", numSub: 5 }]
5829
6307
  *
5830
6308
  * const result2 = await client.pubsubNumsub([]);
5831
- * console.log(result2); // Output: []
6309
+ * console.log(result2);
6310
+ * // Output: []
5832
6311
  * ```
5833
6312
  */
5834
6313
  async pubsubNumSub(channels, options) {
@@ -5859,7 +6338,9 @@ class BaseClient {
5859
6338
  * await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
5860
6339
  * await client.lpush("user_ids", ["2", "1"]);
5861
6340
  * const result = await client.sort("user_ids", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
5862
- * console.log(result); // Output: [ 'Bob', 'Alice' ] - Returns a list of the names sorted by age
6341
+ * console.log(result);
6342
+ * // Output: [ 'Bob', 'Alice' ]
6343
+ * // Returns a list of the names sorted by age
5863
6344
  * ```
5864
6345
  */
5865
6346
  async sort(key, options) {
@@ -5888,7 +6369,9 @@ class BaseClient {
5888
6369
  * await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
5889
6370
  * await client.lpush("user_ids", ["2", "1"]);
5890
6371
  * const result = await client.sortReadOnly("user_ids", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
5891
- * console.log(result); // Output: [ 'Bob', 'Alice' ] - Returns a list of the names sorted by age
6372
+ * console.log(result);
6373
+ * // Output: [ 'Bob', 'Alice' ]
6374
+ * // Returns a list of the names sorted by age
5892
6375
  * ```
5893
6376
  */
5894
6377
  async sortReadOnly(key, options) {
@@ -5919,8 +6402,13 @@ class BaseClient {
5919
6402
  * await client.hset("user:2", new Map([["name", "Bob"], ["age", "25"]]));
5920
6403
  * await client.lpush("user_ids", ["2", "1"]);
5921
6404
  * const sortedElements = await client.sortStore("user_ids", "sortedList", { byPattern: "user:*->age", getPattern: ["user:*->name"] });
5922
- * console.log(sortedElements); // Output: 2 - number of elements sorted and stored
5923
- * console.log(await client.lrange("sortedList", 0, -1)); // Output: [ 'Bob', 'Alice' ] - Returns a list of the names sorted by age stored in `sortedList`
6405
+ * console.log(sortedElements);
6406
+ * // Output: 2
6407
+ * // number of elements sorted and stored
6408
+ *
6409
+ * console.log(await client.lrange("sortedList", 0, -1));
6410
+ * // Output: [ 'Bob', 'Alice' ]
6411
+ * // Returns a list of the names sorted by age stored in `sortedList`
5924
6412
  * ```
5925
6413
  */
5926
6414
  async sortStore(key, destination, options) {
@@ -5955,6 +6443,7 @@ class BaseClient {
5955
6443
  inflightRequestsLimit: options.inflightRequestsLimit,
5956
6444
  clientAz: options.clientAz ?? null,
5957
6445
  connectionRetryStrategy: options.connectionBackoff,
6446
+ lazyConnect: options.lazyConnect ?? false,
5958
6447
  };
5959
6448
  }
5960
6449
  /**
@@ -6059,7 +6548,8 @@ class BaseClient {
6059
6548
  *
6060
6549
  * @example
6061
6550
  * ```typescript
6062
- * await client.updateConnectionPassword("newPassword", true) // "OK"
6551
+ * await client.updateConnectionPassword("newPassword", true)
6552
+ * // Output: "OK"
6063
6553
  * ```
6064
6554
  */
6065
6555
  async updateConnectionPassword(password, immediateAuth = false) {