-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathIDatabase.cs
More file actions
2858 lines (2635 loc) · 195 KB
/
IDatabase.cs
File metadata and controls
2858 lines (2635 loc) · 195 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Net;
namespace StackExchange.Redis
{
/// <summary>
/// Describes functionality that is common to both standalone redis servers and redis clusters
/// </summary>
public interface IDatabase : IRedis, IDatabaseAsync
{
/// <summary>
/// The numeric identifier of this database
/// </summary>
int Database { get; }
/// <summary>
/// Allows creation of a group of operations that will be sent to the server as a single unit,
/// but which may or may not be processed on the server contiguously.
/// </summary>
/// <param name="asyncState">The async object state to be passed into the created <see cref="IBatch"/>.</param>
/// <returns>The created batch.</returns>
IBatch CreateBatch(object? asyncState = null);
/// <summary>
/// Allows creation of a group of operations that will be sent to the server as a single unit,
/// and processed on the server as a single unit.
/// </summary>
/// <param name="asyncState">The async object state to be passed into the created <see cref="ITransaction"/>.</param>
/// <returns>The created transaction.</returns>
ITransaction CreateTransaction(object? asyncState = null);
/// <summary>
/// Atomically transfer a key from a source Redis instance to a destination Redis instance.
/// On success the key is deleted from the original instance by default, and is guaranteed to exist in the target instance.
/// </summary>
/// <param name="key">The key to migrate.</param>
/// <param name="toServer">The server to migrate the key to.</param>
/// <param name="toDatabase">The database to migrate the key to.</param>
/// <param name="timeoutMilliseconds">The timeout to use for the transfer.</param>
/// <param name="migrateOptions">The options to use for this migration.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <remarks><seealso href="https://redis.io/commands/migrate"/></remarks>
void KeyMigrate(RedisKey key, EndPoint toServer, int toDatabase = 0, int timeoutMilliseconds = 0, MigrateOptions migrateOptions = MigrateOptions.None, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the raw DEBUG OBJECT output for a key.
/// This command is not fully documented and should be avoided unless you have good reason, and then avoided anyway.
/// </summary>
/// <param name="key">The key to debug.</param>
/// <param name="flags">The flags to use for this migration.</param>
/// <returns>The raw output from DEBUG OBJECT.</returns>
/// <remarks><seealso href="https://redis.io/commands/debug-object"/></remarks>
RedisValue DebugObject(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified member to the set stored at key.
/// Specified members that are already a member of this set are ignored.
/// If key does not exist, a new set is created before adding the specified members.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="longitude">The longitude of geo entry.</param>
/// <param name="latitude">The latitude of the geo entry.</param>
/// <param name="member">The value to set at this entry.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the specified member was not already present in the set, else <see langword="false"/>.</returns>
/// <remarks><seealso href="https://redis.io/commands/geoadd"/></remarks>
bool GeoAdd(RedisKey key, double longitude, double latitude, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified member to the set stored at key.
/// Specified members that are already a member of this set are ignored.
/// If key does not exist, a new set is created before adding the specified members.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="value">The geo value to store.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the specified member was not already present in the set, else <see langword="false"/>.</returns>
/// <remarks><seealso href="https://redis.io/commands/geoadd"/></remarks>
bool GeoAdd(RedisKey key, GeoEntry value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Add the specified members to the set stored at key.
/// Specified members that are already a member of this set are ignored.
/// If key does not exist, a new set is created before adding the specified members.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="values">The geo values add to the set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of elements that were added to the set, not including all the elements already present into the set.</returns>
/// <remarks><seealso href="https://redis.io/commands/geoadd"/></remarks>
long GeoAdd(RedisKey key, GeoEntry[] values, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Removes the specified member from the geo sorted set stored at key.
/// Non existing members are ignored.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="member">The geo value to remove.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the member existed in the sorted set and was removed, else <see langword="false"/>.</returns>
/// <remarks><seealso href="https://redis.io/commands/zrem"/></remarks>
bool GeoRemove(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the distance between two members in the geospatial index represented by the sorted set.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="member1">The first member to check.</param>
/// <param name="member2">The second member to check.</param>
/// <param name="unit">The unit of distance to return (defaults to meters).</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The command returns the distance as a double (represented as a string) in the specified unit, or <see langword="null"/> if one or both the elements are missing.</returns>
/// <remarks><seealso href="https://redis.io/commands/geodist"/></remarks>
double? GeoDistance(RedisKey key, RedisValue member1, RedisValue member2, GeoUnit unit = GeoUnit.Meters, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="members">The members to get.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The command returns an array where each element is the Geohash corresponding to each member name passed as argument to the command.</returns>
/// <remarks><seealso href="https://redis.io/commands/geohash"/></remarks>
string?[] GeoHash(RedisKey key, RedisValue[] members, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="member">The member to get.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The command returns an array where each element is the Geohash corresponding to each member name passed as argument to the command.</returns>
/// <remarks><seealso href="https://redis.io/commands/geohash"/></remarks>
string? GeoHash(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="members">The members to get.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>
/// The command returns an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command.
/// Non existing elements are reported as NULL elements of the array.
/// </returns>
/// <remarks><seealso href="https://redis.io/commands/geopos"/></remarks>
GeoPosition?[] GeoPosition(RedisKey key, RedisValue[] members, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="member">The member to get.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>
/// The command returns an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command.
/// Non existing elements are reported as NULL elements of the array.
/// </returns>
/// <remarks><seealso href="https://redis.io/commands/geopos"/></remarks>
GeoPosition? GeoPosition(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the members of a sorted set populated with geospatial information using GEOADD, which are
/// within the borders of the area specified with the center location and the maximum distance from the center (the radius).
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="member">The member to get a radius of results from.</param>
/// <param name="radius">The radius to check.</param>
/// <param name="unit">The unit of <paramref name="radius"/> (defaults to meters).</param>
/// <param name="count">The count of results to get, -1 for unlimited.</param>
/// <param name="order">The order of the results.</param>
/// <param name="options">The search options to use.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The results found within the radius, if any.</returns>
/// <remarks><seealso href="https://redis.io/commands/georadius"/></remarks>
GeoRadiusResult[] GeoRadius(RedisKey key, RedisValue member, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the members of a sorted set populated with geospatial information using <c>GEOADD</c>, which are
/// within the borders of the area specified with the center location and the maximum distance from the center (the radius).
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="longitude">The longitude of the point to get a radius of results from.</param>
/// <param name="latitude">The latitude of the point to get a radius of results from.</param>
/// <param name="radius">The radius to check.</param>
/// <param name="unit">The unit of <paramref name="radius"/> (defaults to meters).</param>
/// <param name="count">The count of results to get, -1 for unlimited.</param>
/// <param name="order">The order of the results.</param>
/// <param name="options">The search options to use.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The results found within the radius, if any.</returns>
/// <remarks><seealso href="https://redis.io/commands/georadius"/></remarks>
GeoRadiusResult[] GeoRadius(RedisKey key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.Meters, int count = -1, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the members of the geo-encoded sorted set stored at <paramref name="key"/> bounded by the provided
/// <paramref name="shape"/>, centered at the provided set <paramref name="member"/>.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="member">The set member to use as the center of the shape.</param>
/// <param name="shape">The shape to use to bound the geo search.</param>
/// <param name="count">The maximum number of results to pull back.</param>
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
/// <param name="order">The order to sort by (defaults to unordered).</param>
/// <param name="options">The search options to use.</param>
/// <param name="flags">The flags for this operation.</param>
/// <returns>The results found within the shape, if any.</returns>
/// <remarks><seealso href="https://redis.io/commands/geosearch"/></remarks>
GeoRadiusResult[] GeoSearch(RedisKey key, RedisValue member, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return the members of the geo-encoded sorted set stored at <paramref name="key"/> bounded by the provided
/// <paramref name="shape"/>, centered at the point provided by the <paramref name="longitude"/> and <paramref name="latitude"/>.
/// </summary>
/// <param name="key">The key of the set.</param>
/// <param name="longitude">The longitude of the center point.</param>
/// <param name="latitude">The latitude of the center point.</param>
/// <param name="shape">The shape to use to bound the geo search.</param>
/// <param name="count">The maximum number of results to pull back.</param>
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
/// <param name="order">The order to sort by (defaults to unordered).</param>
/// <param name="options">The search options to use.</param>
/// <param name="flags">The flags for this operation.</param>
/// <returns>The results found within the shape, if any.</returns>
/// <remarks><seealso href="https://redis.io/commands/geosearch"/></remarks>
GeoRadiusResult[] GeoSearch(RedisKey key, double longitude, double latitude, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, GeoRadiusOptions options = GeoRadiusOptions.Default, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Stores the members of the geo-encoded sorted set stored at <paramref name="sourceKey"/> bounded by the provided
/// <paramref name="shape"/>, centered at the provided set <paramref name="member"/>.
/// </summary>
/// <param name="sourceKey">The key of the set.</param>
/// <param name="destinationKey">The key to store the result at.</param>
/// <param name="member">The set member to use as the center of the shape.</param>
/// <param name="shape">The shape to use to bound the geo search.</param>
/// <param name="count">The maximum number of results to pull back.</param>
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
/// <param name="order">The order to sort by (defaults to unordered).</param>
/// <param name="storeDistances">If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.</param>
/// <param name="flags">The flags for this operation.</param>
/// <returns>The size of the set stored at <paramref name="destinationKey"/>.</returns>
/// <remarks><seealso href="https://redis.io/commands/geosearchstore"/></remarks>
long GeoSearchAndStore(RedisKey sourceKey, RedisKey destinationKey, RedisValue member, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, bool storeDistances = false, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Stores the members of the geo-encoded sorted set stored at <paramref name="sourceKey"/> bounded by the provided
/// <paramref name="shape"/>, centered at the point provided by the <paramref name="longitude"/> and <paramref name="latitude"/>.
/// </summary>
/// <param name="sourceKey">The key of the set.</param>
/// <param name="destinationKey">The key to store the result at.</param>
/// <param name="longitude">The longitude of the center point.</param>
/// <param name="latitude">The latitude of the center point.</param>
/// <param name="shape">The shape to use to bound the geo search.</param>
/// <param name="count">The maximum number of results to pull back.</param>
/// <param name="demandClosest">Whether or not to terminate the search after finding <paramref name="count"/> results. Must be true of count is -1.</param>
/// <param name="order">The order to sort by (defaults to unordered).</param>
/// <param name="storeDistances">If set to true, the resulting set will be a regular sorted-set containing only distances, rather than a geo-encoded sorted-set.</param>
/// <param name="flags">The flags for this operation.</param>
/// <returns>The size of the set stored at <paramref name="destinationKey"/>.</returns>
/// <remarks><seealso href="https://redis.io/commands/geosearchstore"/></remarks>
long GeoSearchAndStore(RedisKey sourceKey, RedisKey destinationKey, double longitude, double latitude, GeoSearchShape shape, int count = -1, bool demandClosest = true, Order? order = null, bool storeDistances = false, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Decrements the number stored at field in the hash stored at key by decrement.
/// If key does not exist, a new key holding a hash is created.
/// If field does not exist the value is set to 0 before the operation is performed.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to decrement.</param>
/// <param name="value">The amount to decrement by.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The value at field after the decrement operation.</returns>
/// <remarks>
/// <para>The range of values supported by HINCRBY is limited to 64 bit signed integers.</para>
/// <para><seealso href="https://redis.io/commands/hincrby"/></para>
/// </remarks>
long HashDecrement(RedisKey key, RedisValue hashField, long value = 1, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Decrement the specified field of an hash stored at key, and representing a floating point number, by the specified decrement.
/// If the field does not exist, it is set to 0 before performing the operation.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to decrement.</param>
/// <param name="value">The amount to decrement by.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The value at field after the decrement operation.</returns>
/// <remarks>
/// <para>The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.</para>
/// <para><seealso href="https://redis.io/commands/hincrbyfloat"/></para>
/// </remarks>
double HashDecrement(RedisKey key, RedisValue hashField, double value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Removes the specified fields from the hash stored at key.
/// Non-existing fields are ignored. Non-existing keys are treated as empty hashes and this command returns 0.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to delete.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of fields that were removed.</returns>
/// <remarks><seealso href="https://redis.io/commands/hdel"/></remarks>
bool HashDelete(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Removes the specified fields from the hash stored at key.
/// Non-existing fields are ignored. Non-existing keys are treated as empty hashes and this command returns 0.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashFields">The fields in the hash to delete.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of fields that were removed.</returns>
/// <remarks><seealso href="https://redis.io/commands/hdel"/></remarks>
long HashDelete(RedisKey key, RedisValue[] hashFields, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns if field is an existing field in the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to check.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the hash contains field, <see langword="false"/> if the hash does not contain field, or key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hexists"/></remarks>
bool HashExists(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the value associated with field in the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to get.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The value associated with field, or nil when field is not present in the hash or key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hget"/></remarks>
RedisValue HashGet(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the value associated with field in the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to get.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The value associated with field, or nil when field is not present in the hash or key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hget"/></remarks>
Lease<byte>? HashGetLease(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the values associated with the specified fields in the hash stored at key.
/// For every field that does not exist in the hash, a nil value is returned.Because a non-existing keys are treated as empty hashes, running HMGET against a non-existing key will return a list of nil values.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashFields">The fields in the hash to get.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List of values associated with the given fields, in the same order as they are requested.</returns>
/// <remarks><seealso href="https://redis.io/commands/hmget"/></remarks>
RedisValue[] HashGet(RedisKey key, RedisValue[] hashFields, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns all fields and values of the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash to get all entries from.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List of fields and their values stored in the hash, or an empty list when key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hgetall"/></remarks>
HashEntry[] HashGetAll(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Increments the number stored at field in the hash stored at key by increment.
/// If key does not exist, a new key holding a hash is created.
/// If field does not exist the value is set to 0 before the operation is performed.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to increment.</param>
/// <param name="value">The amount to increment by.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The value at field after the increment operation.</returns>
/// <remarks>
/// <para>The range of values supported by <c>HINCRBY</c> is limited to 64 bit signed integers.</para>
/// <para><seealso href="https://redis.io/commands/hincrby"/></para>
/// </remarks>
long HashIncrement(RedisKey key, RedisValue hashField, long value = 1, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Increment the specified field of an hash stored at key, and representing a floating point number, by the specified increment.
/// If the field does not exist, it is set to 0 before performing the operation.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field in the hash to increment.</param>
/// <param name="value">The amount to increment by.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The value at field after the increment operation.</returns>
/// <remarks>
/// <para>The precision of the output is fixed at 17 digits after the decimal point regardless of the actual internal precision of the computation.</para>
/// <para><seealso href="https://redis.io/commands/hincrbyfloat"/></para>
/// </remarks>
double HashIncrement(RedisKey key, RedisValue hashField, double value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns all field names in the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List of fields in the hash, or an empty list when key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hkeys"/></remarks>
RedisValue[] HashKeys(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the number of fields contained in the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of fields in the hash, or 0 when key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hlen"/></remarks>
long HashLength(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Gets a random field from the hash at <paramref name="key"/>.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>A random hash field name or <see cref="RedisValue.Null"/> if the hash does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hrandfield"/></remarks>
RedisValue HashRandomField(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Gets <paramref name="count"/> field names from the hash at <paramref name="key"/>.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="count">The number of fields to return.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>An array of hash field names of size of at most <paramref name="count"/>, or <see cref="Array.Empty{RedisValue}"/> if the hash does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hrandfield"/></remarks>
RedisValue[] HashRandomFields(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Gets <paramref name="count"/> field names and values from the hash at <paramref name="key"/>.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="count">The number of fields to return.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>An array of hash entries of size of at most <paramref name="count"/>, or <see cref="Array.Empty{HashEntry}"/> if the hash does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hrandfield"/></remarks>
HashEntry[] HashRandomFieldsWithValues(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
/// <summary>
/// The HSCAN command is used to incrementally iterate over a hash.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="pattern">The pattern of keys to get entries for.</param>
/// <param name="pageSize">The page size to iterate by.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>Yields all elements of the hash matching the pattern.</returns>
/// <remarks><seealso href="https://redis.io/commands/hscan"/></remarks>
IEnumerable<HashEntry> HashScan(RedisKey key, RedisValue pattern, int pageSize, CommandFlags flags);
/// <summary>
/// The HSCAN command is used to incrementally iterate over a hash.
/// Note: to resume an iteration via <i>cursor</i>, cast the original enumerable or enumerator to <see cref="IScanningCursor"/>.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="pattern">The pattern of keys to get entries for.</param>
/// <param name="pageSize">The page size to iterate by.</param>
/// <param name="cursor">The cursor position to start at.</param>
/// <param name="pageOffset">The page offset to start at.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>Yields all elements of the hash matching the pattern.</returns>
/// <remarks><seealso href="https://redis.io/commands/hscan"/></remarks>
IEnumerable<HashEntry> HashScan(RedisKey key, RedisValue pattern = default, int pageSize = RedisBase.CursorUtils.DefaultLibraryPageSize, long cursor = RedisBase.CursorUtils.Origin, int pageOffset = 0, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Sets the specified fields to their respective values in the hash stored at key.
/// This command overwrites any specified fields that already exist in the hash, leaving other unspecified fields untouched.
/// If key does not exist, a new key holding a hash is created.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashFields">The entries to set in the hash.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <remarks><seealso href="https://redis.io/commands/hmset"/></remarks>
void HashSet(RedisKey key, HashEntry[] hashFields, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Sets field in the hash stored at key to value.
/// If key does not exist, a new key holding a hash is created.
/// If field already exists in the hash, it is overwritten.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field to set in the hash.</param>
/// <param name="value">The value to set.</param>
/// <param name="when">Which conditions under which to set the field value (defaults to always).</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if field is a new field in the hash and value was set, <see langword="false"/> if field already exists in the hash and the value was updated.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/hset"/>,
/// <seealso href="https://redis.io/commands/hsetnx"/>
/// </remarks>
bool HashSet(RedisKey key, RedisValue hashField, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the string length of the value associated with field in the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="hashField">The field containing the string</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The length of the string at field, or 0 when key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hstrlen"/></remarks>
long HashStringLength(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns all values in the hash stored at key.
/// </summary>
/// <param name="key">The key of the hash.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>List of values in the hash, or an empty list when key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/hvals"/></remarks>
RedisValue[] HashValues(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Adds the element to the HyperLogLog data structure stored at the variable name specified as first argument.
/// </summary>
/// <param name="key">The key of the hyperloglog.</param>
/// <param name="value">The value to add.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if at least 1 HyperLogLog internal register was altered, <see langword="false"/> otherwise.</returns>
/// <remarks><seealso href="https://redis.io/commands/pfadd"/></remarks>
bool HyperLogLogAdd(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Adds all the element arguments to the HyperLogLog data structure stored at the variable name specified as first argument.
/// </summary>
/// <param name="key">The key of the hyperloglog.</param>
/// <param name="values">The values to add.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if at least 1 HyperLogLog internal register was altered, <see langword="false"/> otherwise.</returns>
/// <remarks><seealso href="https://redis.io/commands/pfadd"/></remarks>
bool HyperLogLogAdd(RedisKey key, RedisValue[] values, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, or 0 if the variable does not exist.
/// </summary>
/// <param name="key">The key of the hyperloglog.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The approximated number of unique elements observed via HyperLogLogAdd.</returns>
/// <remarks><seealso href="https://redis.io/commands/pfcount"/></remarks>
long HyperLogLogLength(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the approximated cardinality of the union of the HyperLogLogs passed, by internally merging the HyperLogLogs stored at the provided keys into a temporary hyperLogLog, or 0 if the variable does not exist.
/// </summary>
/// <param name="keys">The keys of the hyperloglogs.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The approximated number of unique elements observed via HyperLogLogAdd.</returns>
/// <remarks><seealso href="https://redis.io/commands/pfcount"/></remarks>
long HyperLogLogLength(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
/// </summary>
/// <param name="destination">The key of the merged hyperloglog.</param>
/// <param name="first">The key of the first hyperloglog to merge.</param>
/// <param name="second">The key of the first hyperloglog to merge.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <remarks><seealso href="https://redis.io/commands/pfmerge"/></remarks>
void HyperLogLogMerge(RedisKey destination, RedisKey first, RedisKey second, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
/// </summary>
/// <param name="destination">The key of the merged hyperloglog.</param>
/// <param name="sourceKeys">The keys of the hyperloglogs to merge.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <remarks><seealso href="https://redis.io/commands/pfmerge"/></remarks>
void HyperLogLogMerge(RedisKey destination, RedisKey[] sourceKeys, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Indicate exactly which redis server we are talking to.
/// </summary>
/// <param name="key">The key to check.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The endpoint serving the key.</returns>
EndPoint? IdentifyEndpoint(RedisKey key = default, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Copies the value from the <paramref name="sourceKey"/> to the specified <paramref name="destinationKey"/>.
/// </summary>
/// <param name="sourceKey">The key of the source value to copy.</param>
/// <param name="destinationKey">The destination key to copy the source to.</param>
/// <param name="destinationDatabase">The database ID to store <paramref name="destinationKey"/> in. If default (-1), current database is used.</param>
/// <param name="replace">Whether to overwrite an existing values at <paramref name="destinationKey"/>. If <see langword="false"/> and the key exists, the copy will not succeed.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if key was copied. <see langword="false"/> if key was not copied.</returns>
/// <remarks><seealso href="https://redis.io/commands/copy"/></remarks>
bool KeyCopy(RedisKey sourceKey, RedisKey destinationKey, int destinationDatabase = -1, bool replace = false, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Removes the specified key. A key is ignored if it does not exist.
/// If UNLINK is available (Redis 4.0+), it will be used.
/// </summary>
/// <param name="key">The key to delete.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the key was removed.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/del"/>,
/// <seealso href="https://redis.io/commands/unlink"/>
/// </remarks>
bool KeyDelete(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Removes the specified keys. A key is ignored if it does not exist.
/// If UNLINK is available (Redis 4.0+), it will be used.
/// </summary>
/// <param name="keys">The keys to delete.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of keys that were removed.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/del"/>,
/// <seealso href="https://redis.io/commands/unlink"/>
/// </remarks>
long KeyDelete(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Serialize the value stored at key in a Redis-specific format and return it to the user.
/// The returned value can be synthesized back into a Redis key using the RESTORE command.
/// </summary>
/// <param name="key">The key to dump.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The serialized value.</returns>
/// <remarks><seealso href="https://redis.io/commands/dump"/></remarks>
byte[]? KeyDump(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the internal encoding for the Redis object stored at <paramref name="key"/>.
/// </summary>
/// <param name="key">The key to dump.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The Redis encoding for the value or <see langword="null"/> is the key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/object-encoding"/></remarks>
string? KeyEncoding(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns if key exists.
/// </summary>
/// <param name="key">The key to check.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the key exists. <see langword="false"/> if the key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/exists"/></remarks>
bool KeyExists(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Indicates how many of the supplied keys exists.
/// </summary>
/// <param name="keys">The keys to check.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of keys that existed.</returns>
/// <remarks><seealso href="https://redis.io/commands/exists"/></remarks>
long KeyExists(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Set a timeout on <paramref name="key"/>.
/// After the timeout has expired, the key will automatically be deleted.
/// A key with an associated timeout is said to be volatile in Redis terminology.
/// </summary>
/// <param name="key">The key to set the expiration for.</param>
/// <param name="expiry">The timeout to set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the timeout was set. <see langword="false"/> if key does not exist or the timeout could not be set.</returns>
/// <remarks>
/// If key is updated before the timeout has expired, then the timeout is removed as if the PERSIST command was invoked on key.
/// <para>
/// For Redis versions < 2.1.3, existing timeouts cannot be overwritten.
/// So, if key already has an associated timeout, it will do nothing and return 0.
/// </para>
/// <para>
/// Since Redis 2.1.3, you can update the timeout of a key.
/// It is also possible to remove the timeout using the PERSIST command.
/// See the page on key expiry for more information.
/// </para>
/// <para>
/// <seealso href="https://redis.io/commands/expire"/>,
/// <seealso href="https://redis.io/commands/pexpire"/>,
/// <seealso href="https://redis.io/commands/persist"/>
/// </para>
/// </remarks>
bool KeyExpire(RedisKey key, TimeSpan? expiry, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Set a timeout on <paramref name="key"/>.
/// After the timeout has expired, the key will automatically be deleted.
/// A key with an associated timeout is said to be volatile in Redis terminology.
/// </summary>
/// <param name="key">The key to set the expiration for.</param>
/// <param name="expiry">The timeout to set.</param>
/// <param name="when">Since Redis 7.0.0, you can choose under which condition the expiration will be set using <see cref="ExpireWhen"/>.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the timeout was set. <see langword="false"/> if key does not exist or the timeout could not be set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/expire"/>,
/// <seealso href="https://redis.io/commands/pexpire"/>
/// </remarks>
bool KeyExpire(RedisKey key, TimeSpan? expiry, ExpireWhen when, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Set a timeout on <paramref name="key"/>.
/// After the timeout has expired, the key will automatically be deleted.
/// A key with an associated timeout is said to be volatile in Redis terminology.
/// </summary>
/// <param name="key">The key to set the expiration for.</param>
/// <param name="expiry">The exact date to expiry to set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the timeout was set. <see langword="false"/> if key does not exist or the timeout could not be set.</returns>
/// <remarks>
/// If key is updated before the timeout has expired, then the timeout is removed as if the PERSIST command was invoked on key.
/// <para>
/// For Redis versions < 2.1.3, existing timeouts cannot be overwritten.
/// So, if key already has an associated timeout, it will do nothing and return 0.
/// </para>
/// <para>
/// Since Redis 2.1.3, you can update the timeout of a key.
/// It is also possible to remove the timeout using the PERSIST command.
/// See the page on key expiry for more information.
/// </para>
/// <para>
/// <seealso href="https://redis.io/commands/expireat"/>,
/// <seealso href="https://redis.io/commands/pexpireat"/>,
/// <seealso href="https://redis.io/commands/persist"/>
/// </para>
/// </remarks>
bool KeyExpire(RedisKey key, DateTime? expiry, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Set a timeout on <paramref name="key"/>.
/// After the timeout has expired, the key will automatically be deleted.
/// A key with an associated timeout is said to be volatile in Redis terminology.
/// </summary>
/// <param name="key">The key to set the expiration for.</param>
/// <param name="expiry">The timeout to set.</param>
/// <param name="when">Since Redis 7.0.0, you can choose under which condition the expiration will be set using <see cref="ExpireWhen"/>.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the timeout was set. <see langword="false"/> if key does not exist or the timeout could not be set.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/expire"/>,
/// <seealso href="https://redis.io/commands/pexpire"/>
/// </remarks>
bool KeyExpire(RedisKey key, DateTime? expiry, ExpireWhen when, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the absolute time at which the given <paramref name="key"/> will expire, if it exists and has an expiration.
/// </summary>
/// <param name="key">The key to get the expiration for.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The time at which the given key will expire, or <see langword="null"/> if the key does not exist or has no associated expiration time.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/expiretime"/>,
/// <seealso href="https://redis.io/commands/pexpiretime"/>
/// </remarks>
DateTime? KeyExpireTime(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the time since the object stored at the specified key is idle (not requested by read or write operations).
/// </summary>
/// <param name="key">The key to get the time of.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The time since the object stored at the specified key is idle.</returns>
/// <remarks><seealso href="https://redis.io/commands/object"/></remarks>
TimeSpan? KeyIdleTime(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Move key from the currently selected database (see SELECT) to the specified destination database.
/// When key already exists in the destination database, or it does not exist in the source database, it does nothing.
/// It is possible to use MOVE as a locking primitive because of this.
/// </summary>
/// <param name="key">The key to move.</param>
/// <param name="database">The database to move the key to.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if key was moved. <see langword="false"/> if key was not moved.</returns>
/// <remarks><seealso href="https://redis.io/commands/move"/></remarks>
bool KeyMove(RedisKey key, int database, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Remove the existing timeout on key, turning the key from volatile (a key with an expire set) to persistent (a key that will never expire as no timeout is associated).
/// </summary>
/// <param name="key">The key to persist.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the timeout was removed. <see langword="false"/> if key does not exist or does not have an associated timeout.</returns>
/// <remarks><seealso href="https://redis.io/commands/persist"/></remarks>
bool KeyPersist(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Return a random key from the currently selected database.
/// </summary>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The random key, or nil when the database is empty.</returns>
/// <remarks><seealso href="https://redis.io/commands/randomkey"/></remarks>
RedisKey KeyRandom(CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the reference count of the object stored at <paramref name="key"/>.
/// </summary>
/// <param name="key">The key to get a reference count for.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of references (<see langword="Null"/> if the key does not exist).</returns>
/// <remarks><seealso href="https://redis.io/commands/object-refcount"/></remarks>
long? KeyRefCount(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Renames <paramref name="key"/> to <paramref name="newKey"/>.
/// It returns an error when the source and destination names are the same, or when key does not exist.
/// </summary>
/// <param name="key">The key to rename.</param>
/// <param name="newKey">The key to rename to.</param>
/// <param name="when">What conditions to rename under (defaults to always).</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the key was renamed, <see langword="false"/> otherwise.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/rename"/>,
/// <seealso href="https://redis.io/commands/renamenx"/>
/// </remarks>
bool KeyRename(RedisKey key, RedisKey newKey, When when = When.Always, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Create a key associated with a value that is obtained by deserializing the provided serialized value (obtained via DUMP).
/// If <paramref name="expiry"/> is 0 the key is created without any expire, otherwise the specified expire time (in milliseconds) is set.
/// </summary>
/// <param name="key">The key to restore.</param>
/// <param name="value">The value of the key.</param>
/// <param name="expiry">The expiry to set.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <remarks><seealso href="https://redis.io/commands/restore"/></remarks>
void KeyRestore(RedisKey key, byte[] value, TimeSpan? expiry = null, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the remaining time to live of a key that has a timeout.
/// This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset.
/// </summary>
/// <param name="key">The key to check.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>TTL, or nil when key does not exist or does not have a timeout.</returns>
/// <remarks><seealso href="https://redis.io/commands/ttl"/></remarks>
TimeSpan? KeyTimeToLive(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Alters the last access time of a key.
/// </summary>
/// <param name="key">The key to touch.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns><see langword="true"/> if the key was touched, <see langword="false"/> otherwise.</returns>
/// <remarks><seealso href="https://redis.io/commands/touch"/></remarks>
bool KeyTouch(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Alters the last access time of the specified <paramref name="keys"/>. A key is ignored if it does not exist.
/// </summary>
/// <param name="keys">The keys to touch.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The number of keys that were touched.</returns>
/// <remarks><seealso href="https://redis.io/commands/touch"/></remarks>
long KeyTouch(RedisKey[] keys, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the string representation of the type of the value stored at key.
/// The different types that can be returned are: string, list, set, zset and hash.
/// </summary>
/// <param name="key">The key to get the type of.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>Type of key, or none when key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/type"/></remarks>
RedisType KeyType(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Returns the element at index in the list stored at key.
/// The index is zero-based, so 0 means the first element, 1 the second element and so on.
/// Negative indices can be used to designate elements starting at the tail of the list.
/// Here, -1 means the last element, -2 means the penultimate and so forth.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="index">The index position to get the value at.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The requested element, or nil when index is out of range.</returns>
/// <remarks><seealso href="https://redis.io/commands/lindex"/></remarks>
RedisValue ListGetByIndex(RedisKey key, long index, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Inserts value in the list stored at key either before or after the reference value pivot.
/// When key does not exist, it is considered an empty list and no operation is performed.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="pivot">The value to insert after.</param>
/// <param name="value">The value to insert.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The length of the list after the insert operation, or -1 when the value pivot was not found.</returns>
/// <remarks><seealso href="https://redis.io/commands/linsert"/></remarks>
long ListInsertAfter(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Inserts value in the list stored at key either before or after the reference value pivot.
/// When key does not exist, it is considered an empty list and no operation is performed.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="pivot">The value to insert before.</param>
/// <param name="value">The value to insert.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The length of the list after the insert operation, or -1 when the value pivot was not found.</returns>
/// <remarks><seealso href="https://redis.io/commands/linsert"/></remarks>
long ListInsertBefore(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Removes and returns the first element of the list stored at key.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The value of the first element, or nil when key does not exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/lpop"/></remarks>
RedisValue ListLeftPop(RedisKey key, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Removes and returns count elements from the head of the list stored at key.
/// If the list contains less than count elements, removes and returns the number of elements in the list.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="count">The number of elements to remove</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>Array of values that were popped, or nil if the key doesn't exist.</returns>
/// <remarks><seealso href="https://redis.io/commands/lpop"/></remarks>
RedisValue[] ListLeftPop(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Scans through the list stored at <paramref name="key"/> looking for <paramref name="element"/>, returning the 0-based
/// index of the first matching element.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="element">The element to search for.</param>
/// <param name="rank">The rank of the first element to return, within the sub-list of matching indexes in the case of multiple matches.</param>
/// <param name="maxLength">The maximum number of elements to scan through before stopping, defaults to 0 (a full scan of the list.)</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The 0-based index of the first matching element, or -1 if not found.</returns>
/// <remarks><seealso href="https://redis.io/commands/lpos"/></remarks>
long ListPosition(RedisKey key, RedisValue element, long rank = 1, long maxLength = 0, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Scans through the list stored at <paramref name="key"/> looking for <paramref name="count"/> instances of <paramref name="element"/>, returning the 0-based
/// indexes of any matching elements.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="element">The element to search for.</param>
/// <param name="count">The number of matches to find. A count of 0 will return the indexes of all occurrences of the element.</param>
/// <param name="rank">The rank of the first element to return, within the sub-list of matching indexes in the case of multiple matches.</param>
/// <param name="maxLength">The maximum number of elements to scan through before stopping, defaults to 0 (a full scan of the list.)</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>An array of at most <paramref name="count"/> of indexes of matching elements. If none are found, and empty array is returned.</returns>
/// <remarks><seealso href="https://redis.io/commands/lpos"/></remarks>
long[] ListPositions(RedisKey key, RedisValue element, long count, long rank = 1, long maxLength = 0, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Insert the specified value at the head of the list stored at key.
/// If key does not exist, it is created as empty list before performing the push operations.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="value">The value to add to the head of the list.</param>
/// <param name="when">Which conditions to add to the list under (defaults to always).</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The length of the list after the push operations.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/lpush"/>,
/// <seealso href="https://redis.io/commands/lpushx"/>
/// </remarks>
long ListLeftPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Insert the specified value at the head of the list stored at key.
/// If key does not exist, it is created as empty list before performing the push operations.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="values">The value to add to the head of the list.</param>
/// <param name="when">Which conditions to add to the list under (defaults to always).</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The length of the list after the push operations.</returns>
/// <remarks>
/// <seealso href="https://redis.io/commands/lpush"/>,
/// <seealso href="https://redis.io/commands/lpushx"/>
/// </remarks>
long ListLeftPush(RedisKey key, RedisValue[] values, When when = When.Always, CommandFlags flags = CommandFlags.None);
/// <summary>
/// Insert all the specified values at the head of the list stored at key.
/// If key does not exist, it is created as empty list before performing the push operations.
/// Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element.
/// So for instance the command <c>LPUSH mylist a b c</c> will result into a list containing c as first element, b as second element and a as third element.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="values">The values to add to the head of the list.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The length of the list after the push operations.</returns>
/// <remarks><seealso href="https://redis.io/commands/lpush"/></remarks>
long ListLeftPush(RedisKey key, RedisValue[] values, CommandFlags flags);
/// <summary>
/// Returns the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned.
/// </summary>
/// <param name="key">The key of the list.</param>
/// <param name="flags">The flags to use for this operation.</param>
/// <returns>The length of the list at key.</returns>