26 #include <condition_variable> 35 #include <cpp_redis/core/sentinel.hpp> 36 #include <cpp_redis/helpers/variadic_template.hpp> 37 #include <cpp_redis/misc/logger.hpp> 38 #include <cpp_redis/network/redis_connection.hpp> 39 #include <cpp_redis/network/tcp_client_iface.hpp> 82 #ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT 92 explicit client(
const std::shared_ptr<network::tcp_client_iface>& tcp_client);
106 typedef std::function<void(const std::string& host, std::size_t port, connect_state status)>
connect_callback_t;
119 const std::string& host =
"127.0.0.1",
120 std::size_t port = 6379,
121 const connect_callback_t& connect_callback =
nullptr,
122 std::uint32_t timeout_msecs = 0,
123 std::int32_t max_reconnects = 0,
124 std::uint32_t reconnect_interval_msecs = 0);
136 const std::string& name,
137 const connect_callback_t& connect_callback =
nullptr,
138 std::uint32_t timeout_msecs = 0,
139 std::int32_t max_reconnects = 0,
140 std::uint32_t reconnect_interval_msecs = 0);
152 void disconnect(
bool wait_for_removal =
false);
180 client&
send(
const std::vector<std::string>& redis_cmd,
const reply_callback_t& callback);
189 std::future<reply>
send(
const std::vector<std::string>& redis_cmd);
215 template <
class Rep,
class Period>
224 std::unique_lock<std::mutex> lock_callback(m_callbacks_mutex);
225 __CPP_REDIS_LOG(debug,
"cpp_redis::client waiting for callbacks to complete");
226 if (!m_sync_condvar.wait_for(lock_callback, timeout, [=] { return m_callbacks_running == 0 && m_commands.empty(); })) {
227 __CPP_REDIS_LOG(debug,
"cpp_redis::client finished waiting for callback");
230 __CPP_REDIS_LOG(debug,
"cpp_redis::client timed out waiting for callback");
240 bool should_reconnect(
void)
const;
245 void resend_failed_commands(
void);
250 void sleep_before_next_reconnect_attempt(
void);
256 void reconnect(
void);
266 void re_select(
void);
276 void unprotected_send(
const std::vector<std::string>& redis_cmd,
const reply_callback_t& callback);
285 void unprotected_auth(
const std::string& password,
const reply_callback_t& reply_callback);
294 void unprotected_select(
int index,
const reply_callback_t& reply_callback);
304 void add_sentinel(
const std::string& host, std::size_t port, std::uint32_t timeout_msecs = 0);
473 append(
const std::string& key,
const std::string& value,
const reply_callback_t& reply_callback);
474 std::future<reply> append(
const std::string& key,
const std::string& value);
476 client& auth(
const std::string& password,
const reply_callback_t& reply_callback);
477 std::future<reply> auth(
const std::string& password);
479 client& bgrewriteaof(
const reply_callback_t& reply_callback);
480 std::future<reply> bgrewriteaof();
482 client& bgsave(
const reply_callback_t& reply_callback);
483 std::future<reply> bgsave();
485 client& bitcount(
const std::string& key,
const reply_callback_t& reply_callback);
486 std::future<reply> bitcount(
const std::string& key);
488 client& bitcount(
const std::string& key,
int start,
int end,
const reply_callback_t& reply_callback);
489 std::future<reply> bitcount(
const std::string& key,
int start,
int end);
491 client& bitfield(
const std::string& key,
const std::vector<bitfield_operation>& operations,
const reply_callback_t& reply_callback);
492 std::future<reply> bitfield(
const std::string& key,
const std::vector<bitfield_operation>& operations);
494 client& bitop(
const std::string& operation,
const std::string& destkey,
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
495 std::future<reply> bitop(
const std::string& operation,
const std::string& destkey,
const std::vector<std::string>& keys);
497 client& bitpos(
const std::string& key,
int bit,
const reply_callback_t& reply_callback);
498 std::future<reply> bitpos(
const std::string& key,
int bit);
500 client& bitpos(
const std::string& key,
int bit,
int start,
const reply_callback_t& reply_callback);
501 std::future<reply> bitpos(
const std::string& key,
int bit,
int start);
503 client& bitpos(
const std::string& key,
int bit,
int start,
int end,
const reply_callback_t& reply_callback);
504 std::future<reply> bitpos(
const std::string& key,
int bit,
int start,
int end);
506 client& blpop(
const std::vector<std::string>& keys,
int timeout,
const reply_callback_t& reply_callback);
507 std::future<reply> blpop(
const std::vector<std::string>& keys,
int timeout);
509 client& brpop(
const std::vector<std::string>& keys,
int timeout,
const reply_callback_t& reply_callback);
510 std::future<reply> brpop(
const std::vector<std::string>& keys,
int timeout);
512 client& brpoplpush(
const std::string& src,
const std::string& dst,
int timeout,
const reply_callback_t& reply_callback);
513 std::future<reply> brpoplpush(
const std::string& src,
const std::string& dst,
int timeout);
515 template <
typename T,
typename... Ts>
516 client&
client_kill(
const std::string& host,
int port,
const T& arg,
const Ts&... args);
518 template <
typename... Ts>
520 template <
typename T,
typename... Ts>
522 template <
typename T,
typename... Ts>
525 client& client_list(
const reply_callback_t& reply_callback);
526 std::future<reply> client_list();
528 client& client_getname(
const reply_callback_t& reply_callback);
529 std::future<reply> client_getname();
531 client& client_pause(
int timeout,
const reply_callback_t& reply_callback);
532 std::future<reply> client_pause(
int timeout);
534 client& client_reply(
const std::string& mode,
const reply_callback_t& reply_callback);
535 std::future<reply> client_reply(
const std::string& mode);
537 client& client_setname(
const std::string& name,
const reply_callback_t& reply_callback);
538 std::future<reply> client_setname(
const std::string& name);
540 client& cluster_addslots(
const std::vector<std::string>& p_slots,
const reply_callback_t& reply_callback);
541 std::future<reply> cluster_addslots(
const std::vector<std::string>& p_slots);
543 client& cluster_count_failure_reports(
const std::string& node_id,
const reply_callback_t& reply_callback);
544 std::future<reply> cluster_count_failure_reports(
const std::string& node_id);
546 client& cluster_countkeysinslot(
const std::string& slot,
const reply_callback_t& reply_callback);
547 std::future<reply> cluster_countkeysinslot(
const std::string& slot);
549 client& cluster_delslots(
const std::vector<std::string>& p_slots,
const reply_callback_t& reply_callback);
550 std::future<reply> cluster_delslots(
const std::vector<std::string>& p_slots);
552 client& cluster_failover(
const reply_callback_t& reply_callback);
553 std::future<reply> cluster_failover();
555 client& cluster_failover(
const std::string& mode,
const reply_callback_t& reply_callback);
556 std::future<reply> cluster_failover(
const std::string& mode);
558 client& cluster_forget(
const std::string& node_id,
const reply_callback_t& reply_callback);
559 std::future<reply> cluster_forget(
const std::string& node_id);
561 client& cluster_getkeysinslot(
const std::string& slot,
int count,
const reply_callback_t& reply_callback);
562 std::future<reply> cluster_getkeysinslot(
const std::string& slot,
int count);
564 client& cluster_info(
const reply_callback_t& reply_callback);
565 std::future<reply> cluster_info();
567 client& cluster_keyslot(
const std::string& key,
const reply_callback_t& reply_callback);
568 std::future<reply> cluster_keyslot(
const std::string& key);
570 client& cluster_meet(
const std::string& ip,
int port,
const reply_callback_t& reply_callback);
571 std::future<reply> cluster_meet(
const std::string& ip,
int port);
573 client& cluster_nodes(
const reply_callback_t& reply_callback);
574 std::future<reply> cluster_nodes();
576 client& cluster_replicate(
const std::string& node_id,
const reply_callback_t& reply_callback);
577 std::future<reply> cluster_replicate(
const std::string& node_id);
579 client& cluster_reset(
const reply_callback_t& reply_callback);
580 client& cluster_reset(
const std::string& mode,
const reply_callback_t& reply_callback);
581 std::future<reply> cluster_reset(
const std::string& mode =
"soft");
583 client& cluster_saveconfig(
const reply_callback_t& reply_callback);
584 std::future<reply> cluster_saveconfig();
586 client& cluster_set_config_epoch(
const std::string& epoch,
const reply_callback_t& reply_callback);
587 std::future<reply> cluster_set_config_epoch(
const std::string& epoch);
589 client& cluster_setslot(
const std::string& slot,
const std::string& mode,
const reply_callback_t& reply_callback);
590 std::future<reply> cluster_setslot(
const std::string& slot,
const std::string& mode);
592 client& cluster_setslot(
const std::string& slot,
const std::string& mode,
const std::string& node_id,
const reply_callback_t& reply_callback);
593 std::future<reply> cluster_setslot(
const std::string& slot,
const std::string& mode,
const std::string& node_id);
595 client& cluster_slaves(
const std::string& node_id,
const reply_callback_t& reply_callback);
596 std::future<reply> cluster_slaves(
const std::string& node_id);
598 client& cluster_slots(
const reply_callback_t& reply_callback);
599 std::future<reply> cluster_slots();
601 client& command(
const reply_callback_t& reply_callback);
602 std::future<reply> command();
604 client& command_count(
const reply_callback_t& reply_callback);
605 std::future<reply> command_count();
607 client& command_getkeys(
const reply_callback_t& reply_callback);
608 std::future<reply> command_getkeys();
610 client& command_info(
const std::vector<std::string>& command_name,
const reply_callback_t& reply_callback);
611 std::future<reply> command_info(
const std::vector<std::string>& command_name);
613 client& config_get(
const std::string& param,
const reply_callback_t& reply_callback);
614 std::future<reply> config_get(
const std::string& param);
616 client& config_rewrite(
const reply_callback_t& reply_callback);
617 std::future<reply> config_rewrite();
619 client& config_set(
const std::string& param,
const std::string& val,
const reply_callback_t& reply_callback);
620 std::future<reply> config_set(
const std::string& param,
const std::string& val);
622 client& config_resetstat(
const reply_callback_t& reply_callback);
623 std::future<reply> config_resetstat();
625 client& dbsize(
const reply_callback_t& reply_callback);
626 std::future<reply> dbsize();
628 client& debug_object(
const std::string& key,
const reply_callback_t& reply_callback);
629 std::future<reply> debug_object(
const std::string& key);
631 client& debug_segfault(
const reply_callback_t& reply_callback);
632 std::future<reply> debug_segfault();
634 client& decr(
const std::string& key,
const reply_callback_t& reply_callback);
635 std::future<reply> decr(
const std::string& key);
637 client& decrby(
const std::string& key,
int val,
const reply_callback_t& reply_callback);
638 std::future<reply> decrby(
const std::string& key,
int val);
640 client& del(
const std::vector<std::string>& key,
const reply_callback_t& reply_callback);
641 std::future<reply> del(
const std::vector<std::string>& key);
643 client& discard(
const reply_callback_t& reply_callback);
644 std::future<reply> discard();
646 client& dump(
const std::string& key,
const reply_callback_t& reply_callback);
647 std::future<reply> dump(
const std::string& key);
649 client& echo(
const std::string& msg,
const reply_callback_t& reply_callback);
650 std::future<reply> echo(
const std::string& msg);
652 client& eval(
const std::string& script,
int numkeys,
const std::vector<std::string>& keys,
const std::vector<std::string>& args,
const reply_callback_t& reply_callback);
653 std::future<reply> eval(
const std::string& script,
int numkeys,
const std::vector<std::string>& keys,
const std::vector<std::string>& args);
655 client& evalsha(
const std::string& sha1,
int numkeys,
const std::vector<std::string>& keys,
const std::vector<std::string>& args,
const reply_callback_t& reply_callback);
656 std::future<reply> evalsha(
const std::string& sha1,
int numkeys,
const std::vector<std::string>& keys,
const std::vector<std::string>& args);
658 client& exec(
const reply_callback_t& reply_callback);
659 std::future<reply> exec();
661 client& exists(
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
662 std::future<reply> exists(
const std::vector<std::string>& keys);
664 client& expire(
const std::string& key,
int seconds,
const reply_callback_t& reply_callback);
665 std::future<reply> expire(
const std::string& key,
int seconds);
667 client& expireat(
const std::string& key,
int timestamp,
const reply_callback_t& reply_callback);
668 std::future<reply> expireat(
const std::string& key,
int timestamp);
670 client& flushall(
const reply_callback_t& reply_callback);
671 std::future<reply> flushall();
673 client& flushdb(
const reply_callback_t& reply_callback);
674 std::future<reply> flushdb();
676 client& geoadd(
const std::string& key,
const std::vector<std::tuple<std::string, std::string, std::string>>& long_lat_memb,
const reply_callback_t& reply_callback);
677 std::future<reply> geoadd(
const std::string& key,
const std::vector<std::tuple<std::string, std::string, std::string>>& long_lat_memb);
679 client& geohash(
const std::string& key,
const std::vector<std::string>& members,
const reply_callback_t& reply_callback);
680 std::future<reply> geohash(
const std::string& key,
const std::vector<std::string>& members);
682 client& geopos(
const std::string& key,
const std::vector<std::string>& members,
const reply_callback_t& reply_callback);
683 std::future<reply> geopos(
const std::string& key,
const std::vector<std::string>& members);
685 client& geodist(
const std::string& key,
const std::string& member_1,
const std::string& member_2,
const reply_callback_t& reply_callback);
686 client& geodist(
const std::string& key,
const std::string& member_1,
const std::string& member_2,
const std::string& unit,
const reply_callback_t& reply_callback);
687 std::future<reply> geodist(
const std::string& key,
const std::string& member_1,
const std::string& member_2,
const std::string& unit =
"m");
689 client& georadius(
const std::string& 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);
690 client& georadius(
const std::string& key,
double longitude,
double latitude,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order, std::size_t count,
const reply_callback_t& reply_callback);
691 client& georadius(
const std::string& key,
double longitude,
double latitude,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order,
const std::string& store_key,
const reply_callback_t& reply_callback);
692 client& georadius(
const std::string& key,
double longitude,
double latitude,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order,
const std::string& store_key,
const std::string& storedist_key,
const reply_callback_t& reply_callback);
693 client& georadius(
const std::string& key,
double longitude,
double latitude,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order, std::size_t count,
const std::string& store_key,
const reply_callback_t& reply_callback);
694 client& georadius(
const std::string& key,
double longitude,
double latitude,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order, std::size_t count,
const std::string& store_key,
const std::string& storedist_key,
const reply_callback_t& reply_callback);
695 std::future<reply> georadius(
const std::string& 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, std::size_t count = 0,
const std::string& store_key =
"",
const std::string& storedist_key =
"");
697 client& georadiusbymember(
const std::string& key,
const std::string& member,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order,
const reply_callback_t& reply_callback);
698 client& georadiusbymember(
const std::string& key,
const std::string& member,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order, std::size_t count,
const reply_callback_t& reply_callback);
699 client& georadiusbymember(
const std::string& key,
const std::string& member,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order,
const std::string& store_key,
const reply_callback_t& reply_callback);
700 client& georadiusbymember(
const std::string& key,
const std::string& member,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order,
const std::string& store_key,
const std::string& storedist_key,
const reply_callback_t& reply_callback);
701 client& georadiusbymember(
const std::string& key,
const std::string& member,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order, std::size_t count,
const std::string& store_key,
const reply_callback_t& reply_callback);
702 client& georadiusbymember(
const std::string& key,
const std::string& member,
double radius,
geo_unit unit,
bool with_coord,
bool with_dist,
bool with_hash,
bool asc_order, std::size_t count,
const std::string& store_key,
const std::string& storedist_key,
const reply_callback_t& reply_callback);
703 std::future<reply> georadiusbymember(
const std::string& key,
const std::string& member,
double radius,
geo_unit unit,
bool with_coord =
false,
bool with_dist =
false,
bool with_hash =
false,
bool asc_order =
false, std::size_t count = 0,
const std::string& store_key =
"",
const std::string& storedist_key =
"");
705 client&
get(
const std::string& key,
const reply_callback_t& reply_callback);
706 std::future<reply>
get(
const std::string& key);
708 client& getbit(
const std::string& key,
int offset,
const reply_callback_t& reply_callback);
709 std::future<reply> getbit(
const std::string& key,
int offset);
711 client& getrange(
const std::string& key,
int start,
int end,
const reply_callback_t& reply_callback);
712 std::future<reply> getrange(
const std::string& key,
int start,
int end);
714 client& getset(
const std::string& key,
const std::string& val,
const reply_callback_t& reply_callback);
715 std::future<reply> getset(
const std::string& key,
const std::string& val);
717 client& hdel(
const std::string& key,
const std::vector<std::string>& fields,
const reply_callback_t& reply_callback);
718 std::future<reply> hdel(
const std::string& key,
const std::vector<std::string>& fields);
720 client& hexists(
const std::string& key,
const std::string& field,
const reply_callback_t& reply_callback);
721 std::future<reply> hexists(
const std::string& key,
const std::string& field);
723 client& hget(
const std::string& key,
const std::string& field,
const reply_callback_t& reply_callback);
724 std::future<reply> hget(
const std::string& key,
const std::string& field);
726 client& hgetall(
const std::string& key,
const reply_callback_t& reply_callback);
727 std::future<reply> hgetall(
const std::string& key);
729 client& hincrby(
const std::string& key,
const std::string& field,
int incr,
const reply_callback_t& reply_callback);
730 std::future<reply> hincrby(
const std::string& key,
const std::string& field,
int incr);
732 client& hincrbyfloat(
const std::string& key,
const std::string& field,
float incr,
const reply_callback_t& reply_callback);
733 std::future<reply> hincrbyfloat(
const std::string& key,
const std::string& field,
float incr);
735 client& hkeys(
const std::string& key,
const reply_callback_t& reply_callback);
736 std::future<reply> hkeys(
const std::string& key);
738 client& hlen(
const std::string& key,
const reply_callback_t& reply_callback);
739 std::future<reply> hlen(
const std::string& key);
741 client& hmget(
const std::string& key,
const std::vector<std::string>& fields,
const reply_callback_t& reply_callback);
742 std::future<reply> hmget(
const std::string& key,
const std::vector<std::string>& fields);
744 client& hmset(
const std::string& key,
const std::vector<std::pair<std::string, std::string>>& field_val,
const reply_callback_t& reply_callback);
745 std::future<reply> hmset(
const std::string& key,
const std::vector<std::pair<std::string, std::string>>& field_val);
747 client& hscan(
const std::string& key, std::size_t cursor,
const reply_callback_t& reply_callback);
748 std::future<reply> hscan(
const std::string& key, std::size_t cursor);
750 client& hscan(
const std::string& key, std::size_t cursor,
const std::string& pattern,
const reply_callback_t& reply_callback);
751 std::future<reply> hscan(
const std::string& key, std::size_t cursor,
const std::string& pattern);
753 client& hscan(
const std::string& key, std::size_t cursor, std::size_t count,
const reply_callback_t& reply_callback);
754 std::future<reply> hscan(
const std::string& key, std::size_t cursor, std::size_t count);
756 client& hscan(
const std::string& key, std::size_t cursor,
const std::string& pattern, std::size_t count,
const reply_callback_t& reply_callback);
757 std::future<reply> hscan(
const std::string& key, std::size_t cursor,
const std::string& pattern, std::size_t count);
759 client& hset(
const std::string& key,
const std::string& field,
const std::string& value,
const reply_callback_t& reply_callback);
760 std::future<reply> hset(
const std::string& key,
const std::string& field,
const std::string& value);
762 client& hsetnx(
const std::string& key,
const std::string& field,
const std::string& value,
const reply_callback_t& reply_callback);
763 std::future<reply> hsetnx(
const std::string& key,
const std::string& field,
const std::string& value);
765 client& hstrlen(
const std::string& key,
const std::string& field,
const reply_callback_t& reply_callback);
766 std::future<reply> hstrlen(
const std::string& key,
const std::string& field);
768 client& hvals(
const std::string& key,
const reply_callback_t& reply_callback);
769 std::future<reply> hvals(
const std::string& key);
771 client& incr(
const std::string& key,
const reply_callback_t& reply_callback);
772 std::future<reply> incr(
const std::string& key);
774 client& incrby(
const std::string& key,
int incr,
const reply_callback_t& reply_callback);
775 std::future<reply> incrby(
const std::string& key,
int incr);
777 client& incrbyfloat(
const std::string& key,
float incr,
const reply_callback_t& reply_callback);
778 std::future<reply> incrbyfloat(
const std::string& key,
float incr);
780 client& info(
const reply_callback_t& reply_callback);
781 client& info(
const std::string& section,
const reply_callback_t& reply_callback);
782 std::future<reply> info(
const std::string& section =
"default");
784 client& keys(
const std::string& pattern,
const reply_callback_t& reply_callback);
785 std::future<reply> keys(
const std::string& pattern);
787 client& lastsave(
const reply_callback_t& reply_callback);
788 std::future<reply> lastsave();
790 client& lindex(
const std::string& key,
int index,
const reply_callback_t& reply_callback);
791 std::future<reply> lindex(
const std::string& key,
int index);
793 client& linsert(
const std::string& key,
const std::string& before_after,
const std::string& pivot,
const std::string& value,
const reply_callback_t& reply_callback);
794 std::future<reply> linsert(
const std::string& key,
const std::string& before_after,
const std::string& pivot,
const std::string& value);
796 client& llen(
const std::string& key,
const reply_callback_t& reply_callback);
797 std::future<reply> llen(
const std::string& key);
799 client& lpop(
const std::string& key,
const reply_callback_t& reply_callback);
800 std::future<reply> lpop(
const std::string& key);
802 client& lpush(
const std::string& key,
const std::vector<std::string>& values,
const reply_callback_t& reply_callback);
803 std::future<reply> lpush(
const std::string& key,
const std::vector<std::string>& values);
805 client& lpushx(
const std::string& key,
const std::string& value,
const reply_callback_t& reply_callback);
806 std::future<reply> lpushx(
const std::string& key,
const std::string& value);
808 client& lrange(
const std::string& key,
int start,
int stop,
const reply_callback_t& reply_callback);
809 std::future<reply> lrange(
const std::string& key,
int start,
int stop);
811 client& lrem(
const std::string& key,
int count,
const std::string& value,
const reply_callback_t& reply_callback);
812 std::future<reply> lrem(
const std::string& key,
int count,
const std::string& value);
814 client& lset(
const std::string& key,
int index,
const std::string& value,
const reply_callback_t& reply_callback);
815 std::future<reply> lset(
const std::string& key,
int index,
const std::string& value);
817 client& ltrim(
const std::string& key,
int start,
int stop,
const reply_callback_t& reply_callback);
818 std::future<reply> ltrim(
const std::string& key,
int start,
int stop);
820 client& mget(
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
821 std::future<reply> mget(
const std::vector<std::string>& keys);
823 client& migrate(
const std::string& host,
int port,
const std::string& key,
const std::string& dest_db,
int timeout,
const reply_callback_t& reply_callback);
824 client& migrate(
const std::string& host,
int port,
const std::string& key,
const std::string& dest_db,
int timeout,
bool copy,
bool replace,
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
825 std::future<reply> migrate(
const std::string& host,
int port,
const std::string& key,
const std::string& dest_db,
int timeout,
bool copy =
false,
bool replace =
false,
const std::vector<std::string>& keys = {});
827 client& monitor(
const reply_callback_t& reply_callback);
828 std::future<reply> monitor();
830 client& move(
const std::string& key,
const std::string& db,
const reply_callback_t& reply_callback);
831 std::future<reply> move(
const std::string& key,
const std::string& db);
833 client& mset(
const std::vector<std::pair<std::string, std::string>>& key_vals,
const reply_callback_t& reply_callback);
834 std::future<reply> mset(
const std::vector<std::pair<std::string, std::string>>& key_vals);
836 client& msetnx(
const std::vector<std::pair<std::string, std::string>>& key_vals,
const reply_callback_t& reply_callback);
837 std::future<reply> msetnx(
const std::vector<std::pair<std::string, std::string>>& key_vals);
839 client& multi(
const reply_callback_t& reply_callback);
840 std::future<reply> multi();
842 client& object(
const std::string& subcommand,
const std::vector<std::string>& args,
const reply_callback_t& reply_callback);
843 std::future<reply> object(
const std::string& subcommand,
const std::vector<std::string>& args);
845 client& persist(
const std::string& key,
const reply_callback_t& reply_callback);
846 std::future<reply> persist(
const std::string& key);
848 client& pexpire(
const std::string& key,
int milliseconds,
const reply_callback_t& reply_callback);
849 std::future<reply> pexpire(
const std::string& key,
int milliseconds);
851 client& pexpireat(
const std::string& key,
int milliseconds_timestamp,
const reply_callback_t& reply_callback);
852 std::future<reply> pexpireat(
const std::string& key,
int milliseconds_timestamp);
854 client& pfadd(
const std::string& key,
const std::vector<std::string>& elements,
const reply_callback_t& reply_callback);
855 std::future<reply> pfadd(
const std::string& key,
const std::vector<std::string>& elements);
857 client& pfcount(
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
858 std::future<reply> pfcount(
const std::vector<std::string>& keys);
860 client& pfmerge(
const std::string& destkey,
const std::vector<std::string>& sourcekeys,
const reply_callback_t& reply_callback);
861 std::future<reply> pfmerge(
const std::string& destkey,
const std::vector<std::string>& sourcekeys);
863 client& ping(
const reply_callback_t& reply_callback);
864 std::future<reply> ping();
866 client& ping(
const std::string& message,
const reply_callback_t& reply_callback);
867 std::future<reply> ping(
const std::string& message);
869 client& psetex(
const std::string& key,
int milliseconds,
const std::string& val,
const reply_callback_t& reply_callback);
870 std::future<reply> psetex(
const std::string& key,
int milliseconds,
const std::string& val);
872 client& publish(
const std::string& channel,
const std::string& message,
const reply_callback_t& reply_callback);
873 std::future<reply> publish(
const std::string& channel,
const std::string& message);
875 client& pubsub(
const std::string& subcommand,
const std::vector<std::string>& args,
const reply_callback_t& reply_callback);
876 std::future<reply> pubsub(
const std::string& subcommand,
const std::vector<std::string>& args);
878 client& pttl(
const std::string& key,
const reply_callback_t& reply_callback);
879 std::future<reply> pttl(
const std::string& key);
881 client& quit(
const reply_callback_t& reply_callback);
882 std::future<reply> quit();
884 client& randomkey(
const reply_callback_t& reply_callback);
885 std::future<reply> randomkey();
887 client& readonly(
const reply_callback_t& reply_callback);
888 std::future<reply> readonly();
890 client& readwrite(
const reply_callback_t& reply_callback);
891 std::future<reply> readwrite();
893 client& rename(
const std::string& key,
const std::string& newkey,
const reply_callback_t& reply_callback);
894 std::future<reply> rename(
const std::string& key,
const std::string& newkey);
896 client& renamenx(
const std::string& key,
const std::string& newkey,
const reply_callback_t& reply_callback);
897 std::future<reply> renamenx(
const std::string& key,
const std::string& newkey);
899 client& restore(
const std::string& key,
int ttl,
const std::string& serialized_value,
const reply_callback_t& reply_callback);
900 std::future<reply> restore(
const std::string& key,
int ttl,
const std::string& serialized_value);
902 client& restore(
const std::string& key,
int ttl,
const std::string& serialized_value,
const std::string& replace,
const reply_callback_t& reply_callback);
903 std::future<reply> restore(
const std::string& key,
int ttl,
const std::string& serialized_value,
const std::string& replace);
905 client& role(
const reply_callback_t& reply_callback);
906 std::future<reply> role();
908 client& rpop(
const std::string& key,
const reply_callback_t& reply_callback);
909 std::future<reply> rpop(
const std::string& key);
911 client& rpoplpush(
const std::string& source,
const std::string& destination,
const reply_callback_t& reply_callback);
912 std::future<reply> rpoplpush(
const std::string& src,
const std::string& dst);
914 client& rpush(
const std::string& key,
const std::vector<std::string>& values,
const reply_callback_t& reply_callback);
915 std::future<reply> rpush(
const std::string& key,
const std::vector<std::string>& values);
917 client& rpushx(
const std::string& key,
const std::string& value,
const reply_callback_t& reply_callback);
918 std::future<reply> rpushx(
const std::string& key,
const std::string& value);
920 client& sadd(
const std::string& key,
const std::vector<std::string>& members,
const reply_callback_t& reply_callback);
921 std::future<reply> sadd(
const std::string& key,
const std::vector<std::string>& members);
923 client& save(
const reply_callback_t& reply_callback);
924 std::future<reply> save();
926 client& scan(std::size_t cursor,
const reply_callback_t& reply_callback);
927 std::future<reply> scan(std::size_t cursor);
929 client& scan(std::size_t cursor,
const std::string& pattern,
const reply_callback_t& reply_callback);
930 std::future<reply> scan(std::size_t cursor,
const std::string& pattern);
932 client& scan(std::size_t cursor, std::size_t count,
const reply_callback_t& reply_callback);
933 std::future<reply> scan(std::size_t cursor, std::size_t count);
935 client& scan(std::size_t cursor,
const std::string& pattern, std::size_t count,
const reply_callback_t& reply_callback);
936 std::future<reply> scan(std::size_t cursor,
const std::string& pattern, std::size_t count);
938 client& scard(
const std::string& key,
const reply_callback_t& reply_callback);
939 std::future<reply> scard(
const std::string& key);
941 client& script_debug(
const std::string& mode,
const reply_callback_t& reply_callback);
942 std::future<reply> script_debug(
const std::string& mode);
944 client& script_exists(
const std::vector<std::string>& scripts,
const reply_callback_t& reply_callback);
945 std::future<reply> script_exists(
const std::vector<std::string>& scripts);
947 client& script_flush(
const reply_callback_t& reply_callback);
948 std::future<reply> script_flush();
950 client& script_kill(
const reply_callback_t& reply_callback);
951 std::future<reply> script_kill();
953 client& script_load(
const std::string& script,
const reply_callback_t& reply_callback);
954 std::future<reply> script_load(
const std::string& script);
956 client& sdiff(
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
957 std::future<reply> sdiff(
const std::vector<std::string>& keys);
959 client& sdiffstore(
const std::string& destination,
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
960 std::future<reply> sdiffstore(
const std::string& dst,
const std::vector<std::string>& keys);
962 client& select(
int index,
const reply_callback_t& reply_callback);
963 std::future<reply> select(
int index);
965 client&
set(
const std::string& key,
const std::string& value,
const reply_callback_t& reply_callback);
966 std::future<reply>
set(
const std::string& key,
const std::string& value);
968 client& set_advanced(
const std::string& key,
const std::string& value,
const reply_callback_t& reply_callback);
969 client& set_advanced(
const std::string& key,
const std::string& value,
bool ex,
int ex_sec,
bool px,
int px_milli,
bool nx,
bool xx,
const reply_callback_t& reply_callback);
970 std::future<reply> set_advanced(
const std::string& key,
const std::string& value,
bool ex =
false,
int ex_sec = 0,
bool px =
false,
int px_milli = 0,
bool nx =
false,
bool xx =
false);
972 client& setbit_(
const std::string& key,
int offset,
const std::string& value,
const reply_callback_t& reply_callback);
973 std::future<reply> setbit_(
const std::string& key,
int offset,
const std::string& value);
975 client& setex(
const std::string& key,
int seconds,
const std::string& value,
const reply_callback_t& reply_callback);
976 std::future<reply> setex(
const std::string& key,
int seconds,
const std::string& value);
978 client& setnx(
const std::string& key,
const std::string& value,
const reply_callback_t& reply_callback);
979 std::future<reply> setnx(
const std::string& key,
const std::string& value);
981 client& setrange(
const std::string& key,
int offset,
const std::string& value,
const reply_callback_t& reply_callback);
982 std::future<reply> setrange(
const std::string& key,
int offset,
const std::string& value);
984 client& shutdown(
const reply_callback_t& reply_callback);
985 std::future<reply> shutdown();
987 client& shutdown(
const std::string& save,
const reply_callback_t& reply_callback);
988 std::future<reply> shutdown(
const std::string& save);
990 client& sinter(
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
991 std::future<reply> sinter(
const std::vector<std::string>& keys);
993 client& sinterstore(
const std::string& destination,
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
994 std::future<reply> sinterstore(
const std::string& dst,
const std::vector<std::string>& keys);
996 client& sismember(
const std::string& key,
const std::string& member,
const reply_callback_t& reply_callback);
997 std::future<reply> sismember(
const std::string& key,
const std::string& member);
999 client& slaveof(
const std::string& host,
int port,
const reply_callback_t& reply_callback);
1000 std::future<reply> slaveof(
const std::string& host,
int port);
1002 client& slowlog(
const std::string subcommand,
const reply_callback_t& reply_callback);
1003 std::future<reply> slowlog(
const std::string& subcommand);
1005 client& slowlog(
const std::string subcommand,
const std::string& argument,
const reply_callback_t& reply_callback);
1006 std::future<reply> slowlog(
const std::string& subcommand,
const std::string& argument);
1008 client& smembers(
const std::string& key,
const reply_callback_t& reply_callback);
1009 std::future<reply> smembers(
const std::string& key);
1011 client& smove(
const std::string& source,
const std::string& destination,
const std::string& member,
const reply_callback_t& reply_callback);
1012 std::future<reply> smove(
const std::string& src,
const std::string& dst,
const std::string& member);
1014 client& sort(
const std::string& key,
const reply_callback_t& reply_callback);
1015 std::future<reply> sort(
const std::string& key);
1017 client& sort(
const std::string& key,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const reply_callback_t& reply_callback);
1018 std::future<reply> sort(
const std::string& key,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha);
1020 client& sort(
const std::string& key, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const reply_callback_t& reply_callback);
1021 std::future<reply> sort(
const std::string& key, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha);
1023 client& sort(
const std::string& key,
const std::string& by_pattern,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const reply_callback_t& reply_callback);
1024 std::future<reply> sort(
const std::string& key,
const std::string& by_pattern,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha);
1026 client& sort(
const std::string& key,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest,
const reply_callback_t& reply_callback);
1027 std::future<reply> sort(
const std::string& key,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest);
1029 client& sort(
const std::string& key, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest,
const reply_callback_t& reply_callback);
1030 std::future<reply> sort(
const std::string& key, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest);
1032 client& sort(
const std::string& key,
const std::string& by_pattern,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest,
const reply_callback_t& reply_callback);
1033 std::future<reply> sort(
const std::string& key,
const std::string& by_pattern,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest);
1035 client& sort(
const std::string& key,
const std::string& by_pattern, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const reply_callback_t& reply_callback);
1036 std::future<reply> sort(
const std::string& key,
const std::string& by_pattern, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha);
1038 client& sort(
const std::string& key,
const std::string& by_pattern, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest,
const reply_callback_t& reply_callback);
1039 std::future<reply> sort(
const std::string& key,
const std::string& by_pattern, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest);
1041 client& spop(
const std::string& key,
const reply_callback_t& reply_callback);
1042 std::future<reply> spop(
const std::string& key);
1044 client& spop(
const std::string& key,
int count,
const reply_callback_t& reply_callback);
1045 std::future<reply> spop(
const std::string& key,
int count);
1047 client& srandmember(
const std::string& key,
const reply_callback_t& reply_callback);
1048 std::future<reply> srandmember(
const std::string& key);
1050 client& srandmember(
const std::string& key,
int count,
const reply_callback_t& reply_callback);
1051 std::future<reply> srandmember(
const std::string& key,
int count);
1053 client& srem(
const std::string& key,
const std::vector<std::string>& members,
const reply_callback_t& reply_callback);
1054 std::future<reply> srem(
const std::string& key,
const std::vector<std::string>& members);
1056 client& sscan(
const std::string& key, std::size_t cursor,
const reply_callback_t& reply_callback);
1057 std::future<reply> sscan(
const std::string& key, std::size_t cursor);
1059 client& sscan(
const std::string& key, std::size_t cursor,
const std::string& pattern,
const reply_callback_t& reply_callback);
1060 std::future<reply> sscan(
const std::string& key, std::size_t cursor,
const std::string& pattern);
1062 client& sscan(
const std::string& key, std::size_t cursor, std::size_t count,
const reply_callback_t& reply_callback);
1063 std::future<reply> sscan(
const std::string& key, std::size_t cursor, std::size_t count);
1065 client& sscan(
const std::string& key, std::size_t cursor,
const std::string& pattern, std::size_t count,
const reply_callback_t& reply_callback);
1066 std::future<reply> sscan(
const std::string& key, std::size_t cursor,
const std::string& pattern, std::size_t count);
1068 client& strlen(
const std::string& key,
const reply_callback_t& reply_callback);
1069 std::future<reply> strlen(
const std::string& key);
1071 client& sunion(
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
1072 std::future<reply> sunion(
const std::vector<std::string>& keys);
1074 client& sunionstore(
const std::string& destination,
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
1075 std::future<reply> sunionstore(
const std::string& dst,
const std::vector<std::string>& keys);
1077 client& sync(
const reply_callback_t& reply_callback);
1078 std::future<reply> sync();
1080 client& time(
const reply_callback_t& reply_callback);
1081 std::future<reply> time();
1083 client& ttl(
const std::string& key,
const reply_callback_t& reply_callback);
1084 std::future<reply> ttl(
const std::string& key);
1086 client& type(
const std::string& key,
const reply_callback_t& reply_callback);
1087 std::future<reply> type(
const std::string& key);
1089 client& unwatch(
const reply_callback_t& reply_callback);
1090 std::future<reply> unwatch();
1092 client& wait(
int numslaves,
int timeout,
const reply_callback_t& reply_callback);
1093 std::future<reply> wait(
int numslaves,
int timeout);
1095 client& watch(
const std::vector<std::string>& keys,
const reply_callback_t& reply_callback);
1096 std::future<reply> watch(
const std::vector<std::string>& keys);
1098 client& zadd(
const std::string& key,
const std::vector<std::string>& options,
const std::multimap<std::string, std::string>& score_members,
const reply_callback_t& reply_callback);
1099 std::future<reply> zadd(
const std::string& key,
const std::vector<std::string>& options,
const std::multimap<std::string, std::string>& score_members);
1101 client& zcard(
const std::string& key,
const reply_callback_t& reply_callback);
1102 std::future<reply> zcard(
const std::string& key);
1104 client& zcount(
const std::string& key,
int min,
int max,
const reply_callback_t& reply_callback);
1105 std::future<reply> zcount(
const std::string& key,
int min,
int max);
1107 client& zcount(
const std::string& key,
double min,
double max,
const reply_callback_t& reply_callback);
1108 std::future<reply> zcount(
const std::string& key,
double min,
double max);
1110 client& zcount(
const std::string& key,
const std::string& min,
const std::string& max,
const reply_callback_t& reply_callback);
1111 std::future<reply> zcount(
const std::string& key,
const std::string& min,
const std::string& max);
1113 client& zincrby(
const std::string& key,
int incr,
const std::string& member,
const reply_callback_t& reply_callback);
1114 std::future<reply> zincrby(
const std::string& key,
int incr,
const std::string& member);
1116 client& zincrby(
const std::string& key,
double incr,
const std::string& member,
const reply_callback_t& reply_callback);
1117 std::future<reply> zincrby(
const std::string& key,
double incr,
const std::string& member);
1119 client& zincrby(
const std::string& key,
const std::string& incr,
const std::string& member,
const reply_callback_t& reply_callback);
1120 std::future<reply> zincrby(
const std::string& key,
const std::string& incr,
const std::string& member);
1122 client& zinterstore(
const std::string& destination, std::size_t numkeys,
const std::vector<std::string>& keys,
const std::vector<std::size_t> weights,
aggregate_method method,
const reply_callback_t& reply_callback);
1123 std::future<reply> zinterstore(
const std::string& destination, std::size_t numkeys,
const std::vector<std::string>& keys,
const std::vector<std::size_t> weights,
aggregate_method method);
1125 client& zlexcount(
const std::string& key,
int min,
int max,
const reply_callback_t& reply_callback);
1126 std::future<reply> zlexcount(
const std::string& key,
int min,
int max);
1128 client& zlexcount(
const std::string& key,
double min,
double max,
const reply_callback_t& reply_callback);
1129 std::future<reply> zlexcount(
const std::string& key,
double min,
double max);
1131 client& zlexcount(
const std::string& key,
const std::string& min,
const std::string& max,
const reply_callback_t& reply_callback);
1132 std::future<reply> zlexcount(
const std::string& key,
const std::string& min,
const std::string& max);
1134 client& zrange(
const std::string& key,
int start,
int stop,
const reply_callback_t& reply_callback);
1135 client& zrange(
const std::string& key,
int start,
int stop,
bool withscores,
const reply_callback_t& reply_callback);
1136 std::future<reply> zrange(
const std::string& key,
int start,
int stop,
bool withscores =
false);
1138 client& zrange(
const std::string& key,
double start,
double stop,
const reply_callback_t& reply_callback);
1139 client& zrange(
const std::string& key,
double start,
double stop,
bool withscores,
const reply_callback_t& reply_callback);
1140 std::future<reply> zrange(
const std::string& key,
double start,
double stop,
bool withscores =
false);
1142 client& zrange(
const std::string& key,
const std::string& start,
const std::string& stop,
const reply_callback_t& reply_callback);
1143 client& zrange(
const std::string& key,
const std::string& start,
const std::string& stop,
bool withscores,
const reply_callback_t& reply_callback);
1144 std::future<reply> zrange(
const std::string& key,
const std::string& start,
const std::string& stop,
bool withscores =
false);
1146 client& zrangebylex(
const std::string& key,
int min,
int max,
const reply_callback_t& reply_callback);
1147 client& zrangebylex(
const std::string& key,
int min,
int max,
bool withscores,
const reply_callback_t& reply_callback);
1148 std::future<reply> zrangebylex(
const std::string& key,
int min,
int max,
bool withscores =
false);
1150 client& zrangebylex(
const std::string& key,
double min,
double max,
const reply_callback_t& reply_callback);
1151 client& zrangebylex(
const std::string& key,
double min,
double max,
bool withscores,
const reply_callback_t& reply_callback);
1152 std::future<reply> zrangebylex(
const std::string& key,
double min,
double max,
bool withscores =
false);
1154 client& zrangebylex(
const std::string& key,
const std::string& min,
const std::string& max,
const reply_callback_t& reply_callback);
1155 client& zrangebylex(
const std::string& key,
const std::string& min,
const std::string& max,
bool withscores,
const reply_callback_t& reply_callback);
1156 std::future<reply> zrangebylex(
const std::string& key,
const std::string& min,
const std::string& max,
bool withscores =
false);
1158 client& zrangebylex(
const std::string& key,
int min,
int max, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1159 client& zrangebylex(
const std::string& key,
int min,
int max, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1160 std::future<reply> zrangebylex(
const std::string& key,
int min,
int max, std::size_t offset, std::size_t count,
bool withscores =
false);
1162 client& zrangebylex(
const std::string& key,
double min,
double max, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1163 client& zrangebylex(
const std::string& key,
double min,
double max, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1164 std::future<reply> zrangebylex(
const std::string& key,
double min,
double max, std::size_t offset, std::size_t count,
bool withscores =
false);
1166 client& zrangebylex(
const std::string& key,
const std::string& min,
const std::string& max, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1167 client& zrangebylex(
const std::string& key,
const std::string& min,
const std::string& max, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1168 std::future<reply> zrangebylex(
const std::string& key,
const std::string& min,
const std::string& max, std::size_t offset, std::size_t count,
bool withscores =
false);
1170 client& zrangebyscore(
const std::string& key,
int min,
int max,
const reply_callback_t& reply_callback);
1171 client& zrangebyscore(
const std::string& key,
int min,
int max,
bool withscores,
const reply_callback_t& reply_callback);
1172 std::future<reply> zrangebyscore(
const std::string& key,
int min,
int max,
bool withscores =
false);
1174 client& zrangebyscore(
const std::string& key,
double min,
double max,
const reply_callback_t& reply_callback);
1175 client& zrangebyscore(
const std::string& key,
double min,
double max,
bool withscores,
const reply_callback_t& reply_callback);
1176 std::future<reply> zrangebyscore(
const std::string& key,
double min,
double max,
bool withscores =
false);
1178 client& zrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max,
const reply_callback_t& reply_callback);
1179 client& zrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max,
bool withscores,
const reply_callback_t& reply_callback);
1180 std::future<reply> zrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max,
bool withscores =
false);
1182 client& zrangebyscore(
const std::string& key,
int min,
int max, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1183 client& zrangebyscore(
const std::string& key,
int min,
int max, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1184 std::future<reply> zrangebyscore(
const std::string& key,
int min,
int max, std::size_t offset, std::size_t count,
bool withscores =
false);
1186 client& zrangebyscore(
const std::string& key,
double min,
double max, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1187 client& zrangebyscore(
const std::string& key,
double min,
double max, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1188 std::future<reply> zrangebyscore(
const std::string& key,
double min,
double max, std::size_t offset, std::size_t count,
bool withscores =
false);
1190 client& zrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1191 client& zrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1192 std::future<reply> zrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max, std::size_t offset, std::size_t count,
bool withscores =
false);
1194 client& zrank(
const std::string& key,
const std::string& member,
const reply_callback_t& reply_callback);
1195 std::future<reply> zrank(
const std::string& key,
const std::string& member);
1197 client& zrem(
const std::string& key,
const std::vector<std::string>& members,
const reply_callback_t& reply_callback);
1198 std::future<reply> zrem(
const std::string& key,
const std::vector<std::string>& members);
1200 client& zremrangebylex(
const std::string& key,
int min,
int max,
const reply_callback_t& reply_callback);
1201 std::future<reply> zremrangebylex(
const std::string& key,
int min,
int max);
1203 client& zremrangebylex(
const std::string& key,
double min,
double max,
const reply_callback_t& reply_callback);
1204 std::future<reply> zremrangebylex(
const std::string& key,
double min,
double max);
1206 client& zremrangebylex(
const std::string& key,
const std::string& min,
const std::string& max,
const reply_callback_t& reply_callback);
1207 std::future<reply> zremrangebylex(
const std::string& key,
const std::string& min,
const std::string& max);
1209 client& zremrangebyrank(
const std::string& key,
int start,
int stop,
const reply_callback_t& reply_callback);
1210 std::future<reply> zremrangebyrank(
const std::string& key,
int start,
int stop);
1212 client& zremrangebyrank(
const std::string& key,
double start,
double stop,
const reply_callback_t& reply_callback);
1213 std::future<reply> zremrangebyrank(
const std::string& key,
double start,
double stop);
1215 client& zremrangebyrank(
const std::string& key,
const std::string& start,
const std::string& stop,
const reply_callback_t& reply_callback);
1216 std::future<reply> zremrangebyrank(
const std::string& key,
const std::string& start,
const std::string& stop);
1218 client& zremrangebyscore(
const std::string& key,
int min,
int max,
const reply_callback_t& reply_callback);
1219 std::future<reply> zremrangebyscore(
const std::string& key,
int min,
int max);
1221 client& zremrangebyscore(
const std::string& key,
double min,
double max,
const reply_callback_t& reply_callback);
1222 std::future<reply> zremrangebyscore(
const std::string& key,
double min,
double max);
1224 client& zremrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max,
const reply_callback_t& reply_callback);
1225 std::future<reply> zremrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max);
1227 client& zrevrange(
const std::string& key,
int start,
int stop,
const reply_callback_t& reply_callback);
1228 client& zrevrange(
const std::string& key,
int start,
int stop,
bool withscores,
const reply_callback_t& reply_callback);
1229 std::future<reply> zrevrange(
const std::string& key,
int start,
int stop,
bool withscores =
false);
1231 client& zrevrange(
const std::string& key,
double start,
double stop,
const reply_callback_t& reply_callback);
1232 client& zrevrange(
const std::string& key,
double start,
double stop,
bool withscores,
const reply_callback_t& reply_callback);
1233 std::future<reply> zrevrange(
const std::string& key,
double start,
double stop,
bool withscores =
false);
1235 client& zrevrange(
const std::string& key,
const std::string& start,
const std::string& stop,
const reply_callback_t& reply_callback);
1236 client& zrevrange(
const std::string& key,
const std::string& start,
const std::string& stop,
bool withscores,
const reply_callback_t& reply_callback);
1237 std::future<reply> zrevrange(
const std::string& key,
const std::string& start,
const std::string& stop,
bool withscores =
false);
1239 client& zrevrangebylex(
const std::string& key,
int max,
int min,
const reply_callback_t& reply_callback);
1240 client& zrevrangebylex(
const std::string& key,
int max,
int min,
bool withscores,
const reply_callback_t& reply_callback);
1241 std::future<reply> zrevrangebylex(
const std::string& key,
int max,
int min,
bool withscores =
false);
1243 client& zrevrangebylex(
const std::string& key,
double max,
double min,
const reply_callback_t& reply_callback);
1244 client& zrevrangebylex(
const std::string& key,
double max,
double min,
bool withscores,
const reply_callback_t& reply_callback);
1245 std::future<reply> zrevrangebylex(
const std::string& key,
double max,
double min,
bool withscores =
false);
1247 client& zrevrangebylex(
const std::string& key,
const std::string& max,
const std::string& min,
const reply_callback_t& reply_callback);
1248 client& zrevrangebylex(
const std::string& key,
const std::string& max,
const std::string& min,
bool withscores,
const reply_callback_t& reply_callback);
1249 std::future<reply> zrevrangebylex(
const std::string& key,
const std::string& max,
const std::string& min,
bool withscores =
false);
1251 client& zrevrangebylex(
const std::string& key,
int max,
int min, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1252 client& zrevrangebylex(
const std::string& key,
int max,
int min, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1253 std::future<reply> zrevrangebylex(
const std::string& key,
int max,
int min, std::size_t offset, std::size_t count,
bool withscores =
false);
1255 client& zrevrangebylex(
const std::string& key,
double max,
double min, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1256 client& zrevrangebylex(
const std::string& key,
double max,
double min, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1257 std::future<reply> zrevrangebylex(
const std::string& key,
double max,
double min, std::size_t offset, std::size_t count,
bool withscores =
false);
1259 client& zrevrangebylex(
const std::string& key,
const std::string& max,
const std::string& min, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1260 client& zrevrangebylex(
const std::string& key,
const std::string& max,
const std::string& min, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1261 std::future<reply> zrevrangebylex(
const std::string& key,
const std::string& max,
const std::string& min, std::size_t offset, std::size_t count,
bool withscores =
false);
1263 client& zrevrangebyscore(
const std::string& key,
int max,
int min,
const reply_callback_t& reply_callback);
1264 client& zrevrangebyscore(
const std::string& key,
int max,
int min,
bool withscores,
const reply_callback_t& reply_callback);
1265 std::future<reply> zrevrangebyscore(
const std::string& key,
int max,
int min,
bool withscores =
false);
1267 client& zrevrangebyscore(
const std::string& key,
double max,
double min,
const reply_callback_t& reply_callback);
1268 client& zrevrangebyscore(
const std::string& key,
double max,
double min,
bool withscores,
const reply_callback_t& reply_callback);
1269 std::future<reply> zrevrangebyscore(
const std::string& key,
double max,
double min,
bool withscores =
false);
1271 client& zrevrangebyscore(
const std::string& key,
const std::string& max,
const std::string& min,
const reply_callback_t& reply_callback);
1272 client& zrevrangebyscore(
const std::string& key,
const std::string& max,
const std::string& min,
bool withscores,
const reply_callback_t& reply_callback);
1273 std::future<reply> zrevrangebyscore(
const std::string& key,
const std::string& max,
const std::string& min,
bool withscores =
false);
1275 client& zrevrangebyscore(
const std::string& key,
int max,
int min, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1276 client& zrevrangebyscore(
const std::string& key,
int max,
int min, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1277 std::future<reply> zrevrangebyscore(
const std::string& key,
int max,
int min, std::size_t offset, std::size_t count,
bool withscores =
false);
1279 client& zrevrangebyscore(
const std::string& key,
double max,
double min, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1280 client& zrevrangebyscore(
const std::string& key,
double max,
double min, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1281 std::future<reply> zrevrangebyscore(
const std::string& key,
double max,
double min, std::size_t offset, std::size_t count,
bool withscores =
false);
1283 client& zrevrangebyscore(
const std::string& key,
const std::string& max,
const std::string& min, std::size_t offset, std::size_t count,
const reply_callback_t& reply_callback);
1284 client& zrevrangebyscore(
const std::string& key,
const std::string& max,
const std::string& min, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1285 std::future<reply> zrevrangebyscore(
const std::string& key,
const std::string& max,
const std::string& min, std::size_t offset, std::size_t count,
bool withscores =
false);
1287 client& zrevrank(
const std::string& key,
const std::string& member,
const reply_callback_t& reply_callback);
1288 std::future<reply> zrevrank(
const std::string& key,
const std::string& member);
1290 client& zscan(
const std::string& key, std::size_t cursor,
const reply_callback_t& reply_callback);
1291 std::future<reply> zscan(
const std::string& key, std::size_t cursor);
1293 client& zscan(
const std::string& key, std::size_t cursor,
const std::string& pattern,
const reply_callback_t& reply_callback);
1294 std::future<reply> zscan(
const std::string& key, std::size_t cursor,
const std::string& pattern);
1296 client& zscan(
const std::string& key, std::size_t cursor, std::size_t count,
const reply_callback_t& reply_callback);
1297 std::future<reply> zscan(
const std::string& key, std::size_t cursor, std::size_t count);
1299 client& zscan(
const std::string& key, std::size_t cursor,
const std::string& pattern, std::size_t count,
const reply_callback_t& reply_callback);
1300 std::future<reply> zscan(
const std::string& key, std::size_t cursor,
const std::string& pattern, std::size_t count);
1302 client& zscore(
const std::string& key,
const std::string& member,
const reply_callback_t& reply_callback);
1303 std::future<reply> zscore(
const std::string& key,
const std::string& member);
1305 client& zunionstore(
const std::string& destination, std::size_t numkeys,
const std::vector<std::string>& keys,
const std::vector<std::size_t> weights,
aggregate_method method,
const reply_callback_t& reply_callback);
1306 std::future<reply> zunionstore(
const std::string& destination, std::size_t numkeys,
const std::vector<std::string>& keys,
const std::vector<std::size_t> weights,
aggregate_method method);
1310 template <
typename T>
1311 typename std::enable_if<std::is_same<T, client_type>::value>::type
1312 client_kill_unpack_arg(std::vector<std::string>& redis_cmd, reply_callback_t&,
client_type type);
1314 template <
typename T>
1315 typename std::enable_if<std::is_same<T, bool>::value>::type
1316 client_kill_unpack_arg(std::vector<std::string>& redis_cmd, reply_callback_t&,
bool skip);
1318 template <
typename T>
1319 typename std::enable_if<std::is_integral<T>::value>::type
1320 client_kill_unpack_arg(std::vector<std::string>& redis_cmd, reply_callback_t&, uint64_t
id);
1322 template <
typename T>
1323 typename std::enable_if<std::is_class<T>::value>::type
1324 client_kill_unpack_arg(std::vector<std::string>&, reply_callback_t& reply_callback,
const T& cb);
1326 template <
typename T,
typename... Ts>
1328 client_kill_impl(std::vector<std::string>& redis_cmd, reply_callback_t&
reply,
const T& arg,
const Ts&... args);
1330 template <
typename T>
1332 client_kill_impl(std::vector<std::string>& redis_cmd, reply_callback_t&
reply,
const T& arg);
1336 client& sort(
const std::string& key,
const std::string& by_pattern,
bool limit, std::size_t offset, std::size_t count,
const std::vector<std::string>& get_patterns,
bool asc_order,
bool alpha,
const std::string& store_dest,
const reply_callback_t& reply_callback);
1339 client& zrevrangebyscore(
const std::string& key,
const std::string& max,
const std::string& min,
bool limit, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1342 client& zrangebyscore(
const std::string& key,
const std::string& min,
const std::string& max,
bool limit, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1345 client& zrevrangebylex(
const std::string& key,
const std::string& max,
const std::string& min,
bool limit, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1348 client& zrangebylex(
const std::string& key,
const std::string& min,
const std::string& max,
bool limit, std::size_t offset, std::size_t count,
bool withscores,
const reply_callback_t& reply_callback);
1369 void clear_callbacks(
void);
1375 void try_commit(
void);
1378 std::future<reply> exec_cmd(
const std::function<
client&(
const reply_callback_t&)>& f);
1384 struct command_request {
1385 std::vector<std::string> command;
1386 reply_callback_t callback;
1393 std::string m_redis_server;
1397 std::size_t m_redis_port = 0;
1401 std::string m_master_name;
1405 std::string m_password;
1409 int m_database_index = 0;
1424 std::uint32_t m_connect_timeout_msecs = 0;
1428 std::int32_t m_max_reconnects = 0;
1432 std::int32_t m_current_reconnect_attempts = 0;
1436 std::uint32_t m_reconnect_interval_msecs = 0;
1441 std::atomic_bool m_reconnecting;
1445 std::atomic_bool m_cancel;
1450 std::queue<command_request> m_commands;
1455 connect_callback_t m_connect_callback;
1460 std::mutex m_callbacks_mutex;
1465 std::condition_variable m_sync_condvar;
1470 std::atomic<unsigned int> m_callbacks_running;
1475 #include <cpp_redis/impl/client.ipp> Definition: redis_connection.hpp:45
std::future< reply > client_kill_future(const T, const Ts...)
Definition: client.ipp:122
Definition: client.hpp:48
client & operator=(const client &)=delete
assignment operator
Definition: client.hpp:412
void cancel_reconnect(void)
geo_unit
Definition: client.hpp:352
bitfield_operation_type operation_type
Definition: client.hpp:416
client & client_kill(const std::string &host, int port, const T &arg, const Ts &... args)
Definition: client.ipp:93
bitfield_operation_type
Definition: client.hpp:393
std::string aggregate_method_to_string(aggregate_method method) const
client & sync_commit(const std::chrono::duration< Rep, Period > &timeout)
Definition: client.hpp:217
std::string geo_unit_to_string(geo_unit unit) const
bool is_reconnecting(void) const
connect_state
Definition: client.hpp:71
std::function< void(reply &)> reply_callback_t
Definition: client.hpp:169
void add_sentinel(const std::string &host, std::size_t port, std::uint32_t timeout_msecs=0)
std::string type
Definition: client.hpp:421
std::string overflow_type_to_string(overflow_type type) const
void disconnect(bool wait_for_removal=false)
client & sync_commit(void)
client & send(const std::vector< std::string > &redis_cmd, const reply_callback_t &callback)
Definition: sentinel.hpp:40
std::string bitfield_operation_type_to_string(bitfield_operation_type operation) const
void clear_sentinels(void)
overflow_type overflow
Definition: client.hpp:436
void connect(const std::string &host="127.0.0.1", std::size_t port=6379, const connect_callback_t &connect_callback=nullptr, std::uint32_t timeout_msecs=0, std::int32_t max_reconnects=0, std::uint32_t reconnect_interval_msecs=0)
const sentinel & get_sentinel(void) const
client_type
Definition: client.hpp:54
std::function< void(const std::string &host, std::size_t port, connect_state status)> connect_callback_t
Definition: client.hpp:106
int offset
Definition: client.hpp:426
overflow_type
Definition: client.hpp:373
int value
Definition: client.hpp:431
bool is_connected(void) const
Definition: array_builder.hpp:29
aggregate_method
Definition: client.hpp:332