forked from Cylix/cpp_redis
-
Notifications
You must be signed in to change notification settings - Fork 205
Expand file tree
/
Copy pathclient.hpp
More file actions
2622 lines (1891 loc) · 94.6 KB
/
client.hpp
File metadata and controls
2622 lines (1891 loc) · 94.6 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
#include <utility>
// The MIT License (MIT)
//
// Copyright (c) 2015-2017 Simon Ninon <simon.ninon@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef CPP_REDIS_CORE_CLIENT_HPP_
#define CPP_REDIS_CORE_CLIENT_HPP_
#include <atomic>
#include <condition_variable>
#include <functional>
#include <future>
#include <map>
#include <mutex>
#include <queue>
#include <string>
#include <vector>
#include <cpp_redis/core/reply.hpp>
#include <cpp_redis/core/sentinel.hpp>
#include <cpp_redis/helpers/variadic_template.hpp>
#include <cpp_redis/misc/logger.hpp>
#include <cpp_redis/network/redis_connection.hpp>
#include <cpp_redis/network/tcp_client_iface.hpp>
#include <cpp_redis/types/streams_types.hpp>
#include <cpp_redis/misc/deprecated.hpp>
#include <cpp_redis/impl/reply.ipp>
#define __METER "m"
#define __CPP_REDIS_DEFAULT_HOST "127.0.0.1"
#define __CPP_REDIS_DEFAULT_PORT 6379
namespace cpp_redis {
struct client_list_reply {
string_t id;
string_t addr;
string_t name;
};
using client_list_reply_t = client_list_reply;
class client_list_payload
: public virtual reply_payload_iface<client_list_reply_t> {
public:
explicit client_list_payload(reply_t repl)
: reply_payload_iface(std::move(repl)) {}
client_list_reply_t get_payload() override {
client_list_reply_t resp;
if (m_reply.is_bulk_string()) {
string_t repl_str = m_reply.as_string();
auto sep = repl_str.find(' ');
resp.id = repl_str.substr(0, sep);
return resp;
}
throw string_t("Bad reply");
}
};
using client_list_payload_t = client_list_payload;
//!
//! reply callback called whenever a reply is received
//! takes as parameter the received reply
//!
using reply_callback_t = function<void(reply_t &)>;
using client_list_reply_callback_t =
function<void(const client_list_payload_t &)>;
using future_reply_t = future<reply_t>;
//!
//! client is the class providing communication with a Redis server.
//! It is meant to be used for sending commands to the remote server and
//! receiving its replies. The client support asynchronous requests, as well as
//! synchronous ones. Moreover, commands pipelining is supported.
//!
class client {
public:
//!
//! client type
//! used for client kill
//!
enum class client_type { normal, master, pubsub, slave, cluster };
public:
#ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT
//!
//! ctor
//!
client();
#endif // __CPP_REDIS_USE_CUSTOM_TCP_CLIENT //!
//!
//! custom ctor to specify custom tcp_client
//!
//! @param tcp_client tcp client to be used for network communications
//!
explicit client(const shared_ptr<tcp_client_iface_t> &tcp_client);
//!
//! dtor
//!
~client();
//!
//! copy ctor
//!
client(const client &) = delete;
//!
//! assignment operator
//!
client &operator=(const client &) = delete;
public:
//!
//! Connect to redis server
//!
//! @param host host to be connected to
//! @param port port to be connected to
//! @param connect_callback connect handler to be called on connect events
//! (may be null)
//! @param timeout_ms maximum time to connect
//! @param max_reconnects maximum attempts of reconnection if connection
//! dropped
//! @param reconnect_interval_ms time between two attempts of reconnection
//!
void connect(const string_t &host = "127.0.0.1", size_t port = 6379,
const connect_callback_t &connect_callback = nullptr,
uint_t timeout_ms = 0, int_t max_reconnects = 0,
uint_t reconnect_interval_ms = 0);
//!
//! Connect to redis server
//!
//! @param name sentinel name
//! @param connect_callback connect handler to be called on connect events
//! (may be null)
//! @param timeout_ms maximum time to connect
//! @param max_reconnects maximum attempts of reconnection if connection
//! dropped
//! @param reconnect_interval_ms time between two attempts of reconnection
//!
void connect(const string_t &name,
const connect_callback_t &connect_callback = nullptr,
uint_t timeout_ms = 0, int_t max_reconnects = 0,
uint_t reconnect_interval_ms = 0);
//!
//! @return whether we are connected to the redis server
//!
bool is_connected() const;
//!
//! disconnect from redis server
//!
//! @param wait_for_removal when sets to true, disconnect blocks until the
//! underlying TCP client has been effectively removed from the io_service
//! and that all the underlying callbacks have completed.
//!
void disconnect(bool wait_for_removal = false);
//!
//! @return whether an attempt to reconnect is in progress
//!
bool is_reconnecting() const;
//!
//! stop any reconnect in progress
//!
void cancel_reconnect();
public:
//!
//! send the given command
//! the command is actually pipelined and only buffered, so nothing is sent
//! to the network please call commit() / sync_commit() to flush the buffer
//!
//! @param redis_cmd command to be sent
//! @param callback callback to be called on received reply
//! @return current instance
//!
client &send(const vector<string_t> &redis_cmd,
const reply_callback_t &callback);
//!
//! same as the other send method
//! but future based: does not take any callback and return an std:;future to
//! handle the reply
//!
//! @param redis_cmd command to be sent
//! @return future to handler redis reply
//!
future_reply_t send(const vector<string_t> &redis_cmd);
//!
//! Sends all the commands that have been stored by calling send() since the
//! last commit() call to the redis server. That is, pipelining is supported
//! in a very simple and efficient way:
//! client.send(...).send(...).send(...).commit() will send the 3 commands at
//! once (instead of sending 3 network requests, one for each command, as it
//! would have been done without pipelining). Pipelined commands are always
//! removed from the buffer, even in the case of an error (for example,
//! calling commit while the client is not connected, something that throws
//! an exception). commit() works asynchronously: it returns immediately
//! after sending the queued requests and replies are processed
//! asynchronously.
//!
//! Please note that, while commit() can safely be called from inside a reply
//! callback, calling sync_commit() from inside a reply callback is not
//! permitted and will lead to undefined behavior, mostly deadlock.
//!
client &commit();
//!
//! same as commit(), but synchronous
//! will block until all pending commands have been sent and that a reply has
//! been received for each of them and all underlying callbacks completed
//!
//! @return current instance
//!
client &sync_commit();
//!
//! same as sync_commit, but with a timeout
//! will simply block until it completes or timeout expires
//!
//! @return current instance
//!
template <class Rep, class Period>
client &sync_commit(const duration<Rep, Period> &timeout) {
//!
//! no need to call commit in case of reconnection
//! the reconnection flow will do it for us
//!
if (!is_reconnecting()) {
try_commit();
}
unique_lock<mutex_t> lock_callback(m_callbacks_mutex);
__CPP_REDIS_LOG(debug, "client waiting for callbacks to complete");
if (!m_sync_cond_var.wait_for(lock_callback, timeout, [=] {
return m_callbacks_running == 0 && m_commands.empty();
})) {
__CPP_REDIS_LOG(debug, "client finished waiting for callback");
} else {
__CPP_REDIS_LOG(debug, "client timed out waiting for callback");
}
return *this;
}
private:
//!
//! @return whether a reconnection attempt should be performed
//!
bool should_reconnect() const;
//!
//! resend all pending commands that failed to be sent due to disconnection
//!
void resend_failed_commands();
//!
//! sleep between two reconnect attempts if necessary
//!
void sleep_before_next_reconnect_attempt();
//!
//! reconnect to the previously connected host
//! automatically re authenticate and resubscribe to subscribed channel in
//! case of success
//!
void reconnect();
//!
//! re authenticate to redis server based on previously used password
//!
void re_auth();
//!
//! re select db to redis server based on previously selected db
//!
void re_select();
protected:
//!
//! unprotected send
//! same as send, but without any mutex lock
//!
//! @param redis_cmd cmd to be sent
//! @param callback callback to be called whenever a reply is received
//!
virtual void unprotected_send(const vector<string_t> &redis_cmd,
const reply_callback_t &callback);
//!
//! unprotected auth
//! same as auth, but without any mutex lock
//!
//! @param password password to be used for authentication
//! @param reply_callback callback to be called whenever a reply is received
//!
void unprotected_auth(const string_t &password,
const reply_callback_t &reply_callback);
//!
//! unprotected select
//! same as select, but without any mutex lock
//!
//! @param index index to be used for db select
//! @param reply_callback callback to be called whenever a reply is received
//!
void unprotected_select(int index, const reply_callback_t &reply_callback);
//!
//! redis_connection disconnection handler, triggered whenever a
//! disconnection occurred
//!
//! @param connection redis_connection instance
//!
void connection_disconnection_handler(redis_connection_t &connection);
public:
//!
//! add a sentinel definition. Required for connect() or
//! get_master_addr_by_name() when autoconnect is enabled.
//!
//! @param host sentinel host
//! @param port sentinel port
//! @param timeout_ms maximum time to connect
//!
void add_sentinel(const string_t &host, size_t port, uint_t timeout_ms = 0);
//!
//! retrieve sentinel for current client
//!
//! @return sentinel associated to current client
//!
const sentinel &get_sentinel() const;
//!
//! retrieve sentinel for current client
//! non-const version
//!
//! @return sentinel associated to current client
//!
sentinel &get_sentinel();
//!
//! clear all existing sentinels.
//!
void clear_sentinels();
public:
//!
//! aggregate method to be used for some commands (like zunionstore)
//! these match the aggregate methods supported by redis
//! use server_default if you are not willing to specify this parameter and
//! let the server defaults
//!
enum class aggregate_method { sum, min, max, server_default };
//!
//! convert an aggregate_method enum to its equivalent redis-server string
//!
//! @param method aggregate_method to convert
//! @return conversion
//!
string_t aggregate_method_to_string(aggregate_method method) const;
public:
//!
//! geographic unit to be used for some commands (like georadius)
//! these match the geo units supported by redis-server
//!
enum class geo_unit { m, km, ft, mi };
//!
//! convert a geo unit to its equivalent redis-server string
//!
//! @param unit geo_unit to convert
//! @return conversion
//!
string_t geo_unit_to_string(geo_unit unit) const;
public:
//!
//! overflow type to be used for some commands (like bitfield)
//! these match the overflow types supported by redis-server
//! use server_default if you are not willing to specify this parameter and
//! let the server defaults
//!
enum class overflow_type { wrap, sat, fail, server_default };
using overflow_type_t = overflow_type;
//!
//! convert an overflow type to its equivalent redis-server string
//!
//! @param type overflow type to convert
//! @return conversion
//!
string_t overflow_type_to_string(overflow_type_t type) const;
public:
//!
//! bitfield operation type to be used for some commands (like bitfield)
//! these match the bitfield operation types supported by redis-server
//!
enum class bitfield_operation_type { get, set, incrby };
using bitfield_operation_type_t = bitfield_operation_type;
//!
//! convert a bitfield operation type to its equivalent redis-server string
//!
//! @param operation operation type to convert
//! @return conversion
//!
string_t
bitfield_operation_type_to_string(bitfield_operation_type operation) const;
public:
//!
//! used to store a get, set or incrby bitfield operation (for bitfield
//! command)
//!
struct bitfield_operation {
//!
//! operation type (get, set, incrby)
//!
bitfield_operation_type operation_type;
using bitfield_operation_type_t = bitfield_operation_type;
//!
//! redis type parameter for get, set or incrby operations
//!
string_t type;
//!
//! redis offset parameter for get, set or incrby operations
//!
int offset;
//!
//! redis value parameter for set operation, or increment parameter for
//! incrby operation
//!
int value;
//!
//! overflow optional specification
//!
overflow_type_t overflow;
//!
//! build a bitfield_operation for a bitfield get operation
//!
//! @param type type param of a get operation
//! @param offset offset param of a get operation
//! @param overflow overflow specification (leave to server_default if you
//! do not want to specify it)
//! @return corresponding get bitfield_operation
//!
static bitfield_operation
get(const string_t &type, int offset,
overflow_type_t overflow = overflow_type::server_default);
//!
//! build a bitfield_operation for a bitfield set operation
//!
//! @param type type param of a set operation
//! @param offset offset param of a set operation
//! @param value value param of a set operation
//! @param overflow overflow specification (leave to server_default if you
//! do not want to specify it)
//! @return corresponding set bitfield_operation
//!
static bitfield_operation
set(const string_t &type, int offset, int value,
overflow_type_t overflow = overflow_type::server_default);
//!
//! build a bitfield_operation for a bitfield incrby operation
//!
//! @param type type param of a incrby operation
//! @param offset offset param of a incrby operation
//! @param increment increment param of a incrby operation
//! @param overflow overflow specification (leave to server_default if you
//! do not want to specify it)
//! @return corresponding incrby bitfield_operation
//!
static bitfield_operation
incrby(const string_t &type, int offset, int increment,
overflow_type_t overflow = overflow_type::server_default);
};
public:
client &append(const string_t &key, const string_t &value,
const reply_callback_t &reply_callback);
future_reply_t append(const string_t &key, const string_t &value);
client &auth(const string_t &password,
const reply_callback_t &reply_callback);
future_reply_t auth(const string_t &password);
client &bgrewriteaof(const reply_callback_t &reply_callback);
future_reply_t bgrewriteaof();
client &bgsave(const reply_callback_t &reply_callback);
future_reply_t bgsave();
client &bitcount(const string_t &key, const reply_callback_t &reply_callback);
future_reply_t bitcount(const string_t &key);
client &bitcount(const string_t &key, int start, int end,
const reply_callback_t &reply_callback);
future_reply_t bitcount(const string_t &key, int start, int end);
client &bitfield(const string_t &key,
const vector<bitfield_operation> &operations,
const reply_callback_t &reply_callback);
future_reply_t bitfield(const string_t &key,
const vector<bitfield_operation> &operations);
client &bitop(const string_t &operation, const string_t &destkey,
const vector<string_t> &keys,
const reply_callback_t &reply_callback);
future_reply_t bitop(const string_t &operation, const string_t &destkey,
const vector<string_t> &keys);
client &bitpos(const string_t &key, int bit,
const reply_callback_t &reply_callback);
future_reply_t bitpos(const string_t &key, int bit);
client &bitpos(const string_t &key, int bit, int start,
const reply_callback_t &reply_callback);
future_reply_t bitpos(const string_t &key, int bit, int start);
client &bitpos(const string_t &key, int bit, int start, int end,
const reply_callback_t &reply_callback);
future_reply_t bitpos(const string_t &key, int bit, int start, int end);
client &blpop(const vector<string_t> &keys, int timeout,
const reply_callback_t &reply_callback);
future_reply_t blpop(const vector<string_t> &keys, int timeout);
client &brpop(const vector<string_t> &keys, int timeout,
const reply_callback_t &reply_callback);
future_reply_t brpop(const vector<string_t> &keys, int timeout);
client &brpoplpush(const string_t &src, const string_t &dst, int timeout,
const reply_callback_t &reply_callback);
future_reply_t brpoplpush(const string_t &src, const string_t &dst,
int timeout);
client &bzpopmin(const vector<string_t> &keys, int timeout,
const reply_callback_t &reply_callback);
future_reply_t bzpopmin(const vector<string_t> &keys, int timeout);
client &bzpopmax(const vector<string_t> &keys, int timeout,
const reply_callback_t &reply_callback);
future_reply_t bzpopmax(const vector<string_t> &keys, int timeout);
client &client_id(const reply_callback_t &reply_callback);
future_reply_t client_id();
//<editor-fold desc="client">
template <typename T, typename... Ts>
client &client_kill(const string_t &host, int port, const T &arg,
const Ts &... args);
client &client_kill(const string_t &host, int port);
template <typename... Ts>
client &client_kill(const char *host, int port, const Ts &... args);
template <typename T, typename... Ts>
client &client_kill(const T &, const Ts &...);
template <typename T, typename... Ts>
future_reply_t client_kill_future(T, const Ts...);
client &client_list(const reply_callback_t &reply_callback);
client &client_list_test(const client_list_reply_callback_t &reply_callback);
future_reply_t client_list();
client &client_getname(const reply_callback_t &reply_callback);
future_reply_t client_getname();
client &client_pause(int timeout, const reply_callback_t &reply_callback);
future_reply_t client_pause(int timeout);
client &client_reply(const string_t &mode,
const reply_callback_t &reply_callback);
future_reply_t client_reply(const string_t &mode);
client &client_setname(const string_t &name,
const reply_callback_t &reply_callback);
future_reply_t client_setname(const string_t &name);
//</editor-fold>
client &client_unblock(int id, const reply_callback_t &reply_callback);
client &client_unblock(int id, bool witherror,
const reply_callback_t &reply_callback);
future_reply_t client_unblock(int id, bool witherror = false);
client &cluster_addslots(const vector<string_t> &p_slots,
const reply_callback_t &reply_callback);
future_reply_t cluster_addslots(const vector<string_t> &p_slots);
client &cluster_count_failure_reports(const string_t &node_id,
const reply_callback_t &reply_callback);
future_reply_t cluster_count_failure_reports(const string_t &node_id);
client &cluster_countkeysinslot(const string_t &slot,
const reply_callback_t &reply_callback);
future_reply_t cluster_countkeysinslot(const string_t &slot);
client &cluster_delslots(const vector<string_t> &p_slots,
const reply_callback_t &reply_callback);
future_reply_t cluster_delslots(const vector<string_t> &p_slots);
client &cluster_failover(const reply_callback_t &reply_callback);
future_reply_t cluster_failover();
client &cluster_failover(const string_t &mode,
const reply_callback_t &reply_callback);
future_reply_t cluster_failover(const string_t &mode);
client &cluster_forget(const string_t &node_id,
const reply_callback_t &reply_callback);
future_reply_t cluster_forget(const string_t &node_id);
client &cluster_getkeysinslot(const string_t &slot, int count,
const reply_callback_t &reply_callback);
future_reply_t cluster_getkeysinslot(const string_t &slot, int count);
client &cluster_info(const reply_callback_t &reply_callback);
future_reply_t cluster_info();
client &cluster_keyslot(const string_t &key,
const reply_callback_t &reply_callback);
future_reply_t cluster_keyslot(const string_t &key);
client &cluster_meet(const string_t &ip, int port,
const reply_callback_t &reply_callback);
future_reply_t cluster_meet(const string_t &ip, int port);
client &cluster_nodes(const reply_callback_t &reply_callback);
future_reply_t cluster_nodes();
client &cluster_replicate(const string_t &node_id,
const reply_callback_t &reply_callback);
future_reply_t cluster_replicate(const string_t &node_id);
client &cluster_reset(const reply_callback_t &reply_callback);
client &cluster_reset(const string_t &mode,
const reply_callback_t &reply_callback);
future_reply_t cluster_reset(const string_t &mode = "soft");
client &cluster_saveconfig(const reply_callback_t &reply_callback);
future_reply_t cluster_saveconfig();
client &cluster_set_config_epoch(const string_t &epoch,
const reply_callback_t &reply_callback);
future_reply_t cluster_set_config_epoch(const string_t &epoch);
client &cluster_setslot(const string_t &slot, const string_t &mode,
const reply_callback_t &reply_callback);
future_reply_t cluster_setslot(const string_t &slot, const string_t &mode);
client &cluster_setslot(const string_t &slot, const string_t &mode,
const string_t &node_id,
const reply_callback_t &reply_callback);
future_reply_t cluster_setslot(const string_t &slot, const string_t &mode,
const string_t &node_id);
client &cluster_slaves(const string_t &node_id,
const reply_callback_t &reply_callback);
future_reply_t cluster_slaves(const string_t &node_id);
client &cluster_slots(const reply_callback_t &reply_callback);
future_reply_t cluster_slots();
client &command(const reply_callback_t &reply_callback);
future_reply_t command();
client &command_count(const reply_callback_t &reply_callback);
future_reply_t command_count();
client &command_getkeys(const reply_callback_t &reply_callback);
future_reply_t command_getkeys();
client &command_info(const vector<string_t> &command_name,
const reply_callback_t &reply_callback);
future_reply_t command_info(const vector<string_t> &command_name);
client &config_get(const string_t ¶m,
const reply_callback_t &reply_callback);
future_reply_t config_get(const string_t ¶m);
client &config_rewrite(const reply_callback_t &reply_callback);
future_reply_t config_rewrite();
client &config_set(const string_t ¶m, const string_t &val,
const reply_callback_t &reply_callback);
future_reply_t config_set(const string_t ¶m, const string_t &val);
client &config_resetstat(const reply_callback_t &reply_callback);
future_reply_t config_resetstat();
client &dbsize(const reply_callback_t &reply_callback);
future_reply_t dbsize();
client &debug_object(const string_t &key,
const reply_callback_t &reply_callback);
future_reply_t debug_object(const string_t &key);
client &debug_segfault(const reply_callback_t &reply_callback);
future_reply_t debug_segfault();
client &decr(const string_t &key, const reply_callback_t &reply_callback);
future_reply_t decr(const string_t &key);
client &decrby(const string_t &key, int val,
const reply_callback_t &reply_callback);
future_reply_t decrby(const string_t &key, int val);
client &del(const vector<string_t> &key,
const reply_callback_t &reply_callback);
future_reply_t del(const vector<string_t> &key);
client &discard(const reply_callback_t &reply_callback);
future_reply_t discard();
client &dump(const string_t &key, const reply_callback_t &reply_callback);
future_reply_t dump(const string_t &key);
client &echo(const string_t &msg, const reply_callback_t &reply_callback);
future_reply_t echo(const string_t &msg);
client &eval(const string_t &script, const vector<string_t> &keys,
const vector<string_t> &args,
const reply_callback_t &reply_callback);
DEPRECATED client &eval(const string_t &script, int num_keys,
const vector<string_t> &keys,
const vector<string_t> &args,
const reply_callback_t &reply_callback);
future_reply_t eval(const string_t &script, const vector<string_t> &keys,
const vector<string_t> &args);
DEPRECATED future_reply_t eval(const string_t &script, int num_keys,
const vector<string_t> &keys,
const vector<string_t> &args);
client &evalsha(const string_t &sha1, const vector<string_t> &keys,
const vector<string_t> &args,
const reply_callback_t &reply_callback);
DEPRECATED client &evalsha(const string_t &sha1, int num_keys,
const vector<string_t> &keys,
const vector<string_t> &args,
const reply_callback_t &reply_callback);
future_reply_t evalsha(const string_t &sha1, const vector<string_t> &keys,
const vector<string_t> &args);
DEPRECATED future_reply_t evalsha(const string_t &sha1, int num_keys,
const vector<string_t> &keys,
const vector<string_t> &args);
client &exec(const reply_callback_t &reply_callback);
future_reply_t exec();
client &exists(const vector<string_t> &keys,
const reply_callback_t &reply_callback);
future_reply_t exists(const vector<string_t> &keys);
client &expire(const string_t &key, int seconds,
const reply_callback_t &reply_callback);
future_reply_t expire(const string_t &key, int seconds);
client &expireat(const string_t &key, int timestamp,
const reply_callback_t &reply_callback);
future_reply_t expireat(const string_t &key, int timestamp);
client &flushall(const reply_callback_t &reply_callback);
future_reply_t flushall();
client &flushdb(const reply_callback_t &reply_callback);
future_reply_t flushdb();
client &
geoadd(const string_t &key,
const vector<tuple<string_t, string_t, string_t>> &long_lat_memb,
const reply_callback_t &reply_callback);
future_reply_t
geoadd(const string_t &key,
const vector<tuple<string_t, string_t, string_t>> &long_lat_memb);
client &geohash(const string_t &key, const vector<string_t> &members,
const reply_callback_t &reply_callback);
future_reply_t geohash(const string_t &key, const vector<string_t> &members);
client &geopos(const string_t &key, const vector<string_t> &members,
const reply_callback_t &reply_callback);
future_reply_t geopos(const string_t &key, const vector<string_t> &members);
client &geodist(const string_t &key, const string_t &member_1,
const string_t &member_2,
const reply_callback_t &reply_callback);
client &geodist(const string_t &key, const string_t &member_1,
const string_t &member_2, const string_t &unit,
const reply_callback_t &reply_callback);
future_reply_t geodist(const string_t &key, const string_t &member_1,
const string_t &member_2,
const string_t &unit = __METER);
client &georadius(const string_t &key, double longitude, double latitude,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
const reply_callback_t &reply_callback);
client &georadius(const string_t &key, double longitude, double latitude,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
size_t count, const reply_callback_t &reply_callback);
client &georadius(const string_t &key, double longitude, double latitude,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
const string_t &store_key,
const reply_callback_t &reply_callback);
client &georadius(const string_t &key, double longitude, double latitude,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
const string_t &store_key, const string_t &storedist_key,
const reply_callback_t &reply_callback);
client &georadius(const string_t &key, double longitude, double latitude,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
size_t count, const string_t &store_key,
const reply_callback_t &reply_callback);
client &georadius(const string_t &key, double longitude, double latitude,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
size_t count, const string_t &store_key,
const string_t &storedist_key,
const reply_callback_t &reply_callback);
future_reply_t georadius(const string_t &key, double longitude,
double latitude, double radius, geo_unit unit,
bool with_coord = false, bool with_dist = false,
bool with_hash = false, bool asc_order = false,
size_t count = 0, const string_t &store_key = "",
const string_t &storedist_key = "");
client &georadiusbymember(const string_t &key, const string_t &member,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
const reply_callback_t &reply_callback);
client &georadiusbymember(const string_t &key, const string_t &member,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
size_t count,
const reply_callback_t &reply_callback);
client &georadiusbymember(const string_t &key, const string_t &member,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
const string_t &store_key,
const reply_callback_t &reply_callback);
client &georadiusbymember(const string_t &key, const string_t &member,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
const string_t &store_key,
const string_t &storedist_key,
const reply_callback_t &reply_callback);
client &georadiusbymember(const string_t &key, const string_t &member,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
size_t count, const string_t &store_key,
const reply_callback_t &reply_callback);
client &georadiusbymember(const string_t &key, const string_t &member,
double radius, geo_unit unit, bool with_coord,
bool with_dist, bool with_hash, bool asc_order,
size_t count, const string_t &store_key,
const string_t &storedist_key,
const reply_callback_t &reply_callback);