spring_redis/config.rs
1use schemars::JsonSchema;
2use serde::Deserialize;
3use spring::config::Configurable;
4
5spring::submit_config_schema!("redis", RedisConfig);
6
7#[derive(Debug, Configurable, Clone, JsonSchema, Deserialize)]
8#[config_prefix = "redis"]
9pub struct RedisConfig {
10 /// The URI for connecting to the Redis server. For example:
11 /// <redis://127.0.0.1/>
12 pub uri: String,
13
14 /// The new connection will time out operations after `response_timeout` has passed.
15 pub response_timeout: Option<u64>,
16
17 /// Each connection attempt to the server will time out after `connection_timeout`.
18 pub connection_timeout: Option<u64>,
19
20 /// number_of_retries times, with an exponentially increasing delay
21 pub number_of_retries: Option<usize>,
22
23 /// The resulting duration is calculated by taking the base to the `n`-th power,
24 /// where `n` denotes the number of past attempts.
25 pub exponent_base: Option<u64>,
26
27 /// A multiplicative factor that will be applied to the retry delay.
28 ///
29 /// For example, using a factor of `1000` will make each delay in units of seconds.
30 pub factor: Option<u64>,
31
32 /// Apply a maximum delay between connection attempts. The delay between attempts won't be longer than max_delay milliseconds.
33 pub max_delay: Option<u64>,
34}