1use std::time::Duration;
3
4#[derive(Debug, Clone)]
6pub struct CacheConfig {
7 pub default_ttl: Duration,
9
10 pub ttl_random_range: Option<Duration>,
13
14 pub system_name: String,
16}
17
18impl Default for CacheConfig {
19 fn default() -> Self {
20 Self {
21 default_ttl: Duration::from_secs(3600), ttl_random_range: Some(Duration::from_secs(300)), system_name: "secra".to_string(),
24 }
25 }
26}
27
28impl CacheConfig {
29 pub fn new(default_ttl: Duration, ttl_random_range: Option<Duration>) -> Self {
38 Self {
39 default_ttl,
40 ttl_random_range,
41 system_name: "secra".to_string(),
42 }
43 }
44
45 pub fn with_system_name(mut self, system_name: String) -> Self {
53 self.system_name = system_name;
54 self
55 }
56}