pub trait Cache: Send + Sync {
// Required methods
fn get(
&self,
key: &str,
) -> Pin<Box<dyn Future<Output = Option<String>> + Send + '_>>;
fn set(
&self,
key: &str,
value: &str,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error>>> + Send + '_>>;
fn delete(
&self,
key: &str,
) -> Pin<Box<dyn Future<Output = Result<bool, Box<dyn Error>>> + Send + '_>>;
}
Expand description
Cache trait for unified interface