use std::time::Duration;
use async_trait::async_trait;
use super::CacheResult;
#[cfg(feature = "cache_inmem")]
pub mod inmem;
pub mod null;
#[cfg(feature = "cache_redis")]
pub mod redis;
#[async_trait]
pub trait CacheDriver: Sync + Send {
async fn contains_key(&self, key: &str) -> CacheResult<bool>;
async fn get(&self, key: &str) -> CacheResult<Option<String>>;
async fn insert(&self, key: &str, value: &str) -> CacheResult<()>;
async fn insert_with_expiry(
&self,
key: &str,
value: &str,
duration: Duration,
) -> CacheResult<()>;
async fn remove(&self, key: &str) -> CacheResult<()>;
async fn clear(&self) -> CacheResult<()>;
}