Implement simple persistent cache with automatic saving on status changes
This commit is contained in:
@@ -3,23 +3,13 @@ use serde::{Deserialize, Serialize};
|
||||
/// Cache configuration
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct CacheConfig {
|
||||
pub enabled: bool,
|
||||
pub default_ttl_seconds: u64,
|
||||
pub max_entries: usize,
|
||||
pub warming_timeout_seconds: u64,
|
||||
pub background_refresh_enabled: bool,
|
||||
pub cleanup_interval_seconds: u64,
|
||||
pub persist_path: String,
|
||||
}
|
||||
|
||||
impl Default for CacheConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enabled: true,
|
||||
default_ttl_seconds: 30,
|
||||
max_entries: 10000,
|
||||
warming_timeout_seconds: 3,
|
||||
background_refresh_enabled: true,
|
||||
cleanup_interval_seconds: 1800,
|
||||
persist_path: "/var/lib/cm-dashboard/cache.json".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user