shared/domain/ports/
cache.rs1use crate::error::CoreError;
2use async_trait::async_trait;
3
4#[async_trait]
5pub trait CacheAdapter: Send + Sync {
6 async fn insert(&self, key: &str, value: &str, expiration: u64) -> Result<(), CoreError>;
7 async fn find_one(&self, key: &str) -> Result<Option<String>, CoreError>;
8 async fn update(&self, key: &str, value: &str, expiration: u64) -> Result<(), CoreError>;
9 async fn increment(&self, key: &str) -> Result<u64, CoreError>;
10 async fn delete_one(&self, key: &str) -> Result<(), CoreError>;
11
12 async fn flush_all(&self) -> Result<(), CoreError>;
13}