Redis command execution options. More...
#include <userver/storages/redis/command_control.hpp>
Public Types | |
enum class | Strategy { kDefault , kEveryDc , kLocalDcConductor , kNearestServerPing } |
Public Member Functions | |
CommandControl (std::chrono::milliseconds timeout_single, std::chrono::milliseconds timeout_all, std::size_t max_retries, Strategy strategy=Strategy::kDefault, int best_dc_count=0, std::chrono::milliseconds max_ping_latency=std::chrono::milliseconds(0)) | |
CommandControl | MergeWith (const CommandControl &b) const |
CommandControl | MergeWith (const testsuite::RedisControl &) const |
CommandControl | MergeWith (RetryNilFromMaster) const |
std::string | ToString () const |
Public Attributes | |
std::chrono::milliseconds | timeout_single = std::chrono::milliseconds{500} |
Timeout for a single attempt to execute command. | |
std::chrono::milliseconds | timeout_all = std::chrono::milliseconds{2000} |
Command execution timeout, including retries. | |
size_t | max_retries = 4 |
The maximum number of retries while executing command. | |
Strategy | strategy = Strategy::kDefault |
Server instance selection strategy. | |
size_t | best_dc_count = 0 |
How many nearest DCs to use, 0 for no limit. | |
std::chrono::milliseconds | max_ping_latency = std::chrono::milliseconds(0) |
Server latency limit. | |
bool | force_request_to_master = false |
Force execution on master node. | |
bool | allow_reads_from_master = false |
bool | account_in_statistics = true |
Controls if the command execution accounted in statistics. | |
std::optional< std::size_t > | force_shard_idx |
If set, force execution on specific shard. | |
std::size_t | chunk_size = 0 |
Split execution of multi-key commands (i.e., MGET) to multiple requests. | |
ServerId | force_server_id |
bool | force_retries_to_master_on_nil_reply = false |
If set, command retries are directed to the master instance. | |
Friends | |
class | Sentinel |
class | storages::redis::Client |
Redis command execution options.
Definition at line 73 of file command_control.hpp.
|
strong |
Definition at line 74 of file command_control.hpp.
|
friend |
Definition at line 143 of file command_control.hpp.
|
friend |
Definition at line 144 of file command_control.hpp.
bool redis::CommandControl::account_in_statistics = true |
Controls if the command execution accounted in statistics.
Definition at line 114 of file command_control.hpp.
bool redis::CommandControl::allow_reads_from_master = false |
Allow execution of readonly commands on master node along with replica nodes to facilitate load distribution.
Definition at line 111 of file command_control.hpp.
size_t redis::CommandControl::best_dc_count = 0 |
How many nearest DCs to use, 0 for no limit.
Definition at line 101 of file command_control.hpp.
std::size_t redis::CommandControl::chunk_size = 0 |
Split execution of multi-key commands (i.e., MGET) to multiple requests.
Definition at line 120 of file command_control.hpp.
bool redis::CommandControl::force_request_to_master = false |
Force execution on master node.
Definition at line 107 of file command_control.hpp.
bool redis::CommandControl::force_retries_to_master_on_nil_reply = false |
If set, command retries are directed to the master instance.
Definition at line 128 of file command_control.hpp.
ServerId redis::CommandControl::force_server_id |
If set, the user wants a specific Redis instance to handle the command. Sentinel may not redirect the command to other instances. strategy is ignored.
Definition at line 125 of file command_control.hpp.
std::optional<std::size_t> redis::CommandControl::force_shard_idx |
If set, force execution on specific shard.
Definition at line 117 of file command_control.hpp.
std::chrono::milliseconds redis::CommandControl::max_ping_latency = std::chrono::milliseconds(0) |
Server latency limit.
Definition at line 104 of file command_control.hpp.
size_t redis::CommandControl::max_retries = 4 |
The maximum number of retries while executing command.
Definition at line 95 of file command_control.hpp.
Strategy redis::CommandControl::strategy = Strategy::kDefault |
Server instance selection strategy.
Definition at line 98 of file command_control.hpp.
std::chrono::milliseconds redis::CommandControl::timeout_all = std::chrono::milliseconds{2000} |
Command execution timeout, including retries.
Definition at line 92 of file command_control.hpp.
std::chrono::milliseconds redis::CommandControl::timeout_single = std::chrono::milliseconds{500} |
Timeout for a single attempt to execute command.
Definition at line 89 of file command_control.hpp.