aboutsummaryrefslogtreecommitdiff
path: root/cache/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cache/src/lib.rs')
-rw-r--r--cache/src/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/cache/src/lib.rs b/cache/src/lib.rs
index 20e1424..d68266f 100644
--- a/cache/src/lib.rs
+++ b/cache/src/lib.rs
@@ -6,7 +6,7 @@
mod backends;
mod helper;
-use crate::backends::{CacheStorage, filesystem::Filesystem};
+use crate::backends::{CacheStorage, init_backend};
use anyhow::{Context, Result, anyhow};
use log::{info, warn};
use serde::{Deserialize, Serialize};
@@ -26,6 +26,7 @@ pub use helper::{EscapeKey, HashKey};
#[derive(Debug, Deserialize)]
pub struct Config {
+ driver: String,
path: PathBuf,
max_in_memory_cache_size: usize,
}
@@ -49,7 +50,7 @@ static CACHE_STORE: OnceLock<Box<dyn CacheStorage>> = OnceLock::new();
pub fn init_cache() -> Result<()> {
CACHE_STORE
- .set(Box::new(Filesystem::new(&CONF)))
+ .set(init_backend().context("cache backend")?)
.map_err(|_| ())
.unwrap();
Ok(())