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