boost_redis 1.4.2
A redis client library
config.hpp
1/* Copyright (c) 2018-2022 Marcelo Zimbres Silva (mzimbres@gmail.com)
2 *
3 * Distributed under the Boost Software License, Version 1.0. (See
4 * accompanying file LICENSE.txt)
5 */
6
7#ifndef BOOST_REDIS_CONFIG_HPP
8#define BOOST_REDIS_CONFIG_HPP
9
10#include <string>
11#include <chrono>
12#include <optional>
13
14namespace boost::redis
15{
16
20struct address {
22 std::string host = "127.0.0.1";
24 std::string port = "6379";
25};
26
30struct config {
32 bool use_ssl = false;
33
35 address addr = address{"127.0.0.1", "6379"};
36
41 std::string username;
42
47 std::string password;
48
50 std::string clientname = "Boost.Redis";
51
53 std::optional<int> database_index = 0;
54
56 std::string health_check_id = "Boost.Redis";
57
59 std::string log_prefix = "(Boost.Redis) ";
60
62 std::chrono::steady_clock::duration resolve_timeout = std::chrono::seconds{10};
63
65 std::chrono::steady_clock::duration connect_timeout = std::chrono::seconds{10};
66
68 std::chrono::steady_clock::duration ssl_handshake_timeout = std::chrono::seconds{10};
69
74 std::chrono::steady_clock::duration health_check_interval = std::chrono::seconds{2};
75
80 std::chrono::steady_clock::duration reconnect_wait_interval = std::chrono::seconds{1};
81};
82
83} // boost::redis
84
85#endif // BOOST_REDIS_CONFIG_HPP
address addr
Address of the Redis server.
Definition: config.hpp:35
std::string clientname
Client name parameter of the HELLO command.
Definition: config.hpp:50
std::string health_check_id
Message used by the health-checker in boost::redis::connection::async_run.
Definition: config.hpp:56
std::string password
Password passed to the HELLO command. If left empty HELLO will be sent without authentication paramet...
Definition: config.hpp:47
std::string port
Redis port.
Definition: config.hpp:24
std::chrono::steady_clock::duration reconnect_wait_interval
Time waited before trying a reconnection.
Definition: config.hpp:80
std::optional< int > database_index
Database that will be passed to the SELECT command.
Definition: config.hpp:53
std::chrono::steady_clock::duration ssl_handshake_timeout
Time the SSL handshake operation is allowed to last.
Definition: config.hpp:68
std::chrono::steady_clock::duration health_check_interval
Definition: config.hpp:74
bool use_ssl
Uses SSL instead of a plain connection.
Definition: config.hpp:32
std::chrono::steady_clock::duration connect_timeout
Time the connect operation is allowed to last.
Definition: config.hpp:65
std::chrono::steady_clock::duration resolve_timeout
Time the resolve operation is allowed to last.
Definition: config.hpp:62
std::string log_prefix
Logger prefix, see boost::redis::logger.
Definition: config.hpp:59
std::string username
Username passed to the HELLO command. If left empty HELLO will be sent without authentication paramet...
Definition: config.hpp:41
std::string host
Redis host.
Definition: config.hpp:22
Address of a Redis server.
Definition: config.hpp:20
Configure parameters used by the connection classes.
Definition: config.hpp:30