Add max cache item size.

This commit is contained in:
Ara Sadoyan
2026-10-23 15:27:23 +02:00
parent 56c41e2c19
commit 72756a00dd
8 changed files with 32 additions and 6 deletions
+2 -1
View File
@@ -21,7 +21,8 @@ pub async fn init_cache(config: Arc<AppConfig>) {
CACHE_TTL.set(ttl).ok();
if let Some(size) = config.cache_size_mb {
let cache_size = size * 1024 * 1024;
drop(EVICTION.set(Manager::new(cache_size)));
let manager = Manager::new(cache_size);
let _ = EVICTION.set(manager);
}
GLOBAL_STORAGE.set(Box::new(MemCache::new())).ok();
info!("Cache initialized successfully. Storage: {}", cache_storage);