use async_trait::async_trait;
use crate::cache::{config::CacheConfig, error::Result, stats::CacheStats};
use crate::common::namespace::Namespace;
use crate::store::health::HealthReport;
#[async_trait]
pub trait CacheAdapter: Send + Sync {
async fn set(
&self,
key: &str,
value: Vec<u8>,
namespace: Option<&Namespace>,
ttl: Option<std::time::Duration>,
) -> Result<()>;
async fn get(&self, key: &str, namespace: Option<&Namespace>) -> Result<Option<Vec<u8>>>;
async fn delete(&self, key: &str, namespace: Option<&Namespace>) -> Result<bool>;
async fn clear(&self, namespace: Option<&Namespace>) -> Result<usize>;
async fn exists(&self, key: &str, namespace: Option<&Namespace>) -> Result<bool>;
async fn stats(&self, namespace: Option<&Namespace>) -> Result<CacheStats>;
async fn healthcheck(&self) -> HealthReport;
fn name(&self) -> &'static str;
fn is_connected(&self) -> bool;
fn config(&self) -> &CacheConfig;
}