use std::{fmt::Debug, time::Duration};
pub use async_redis::AsyncRedisBackend;
use async_trait::async_trait;
pub mod async_redis;
#[async_trait]
pub trait AsyncBackend<T>: Debug {
type Error: std::error::Error;
async fn get(&self, key: &str) -> Result<Option<T>, Self::Error>;
async fn put(
&self,
key: &str,
value: &T,
tags: &[&str],
ttl: Duration,
) -> Result<(), Self::Error>;
async fn pop_key(&self, key: &str) -> Result<(), Self::Error>;
async fn pop_tag(&self, tag: &str) -> Result<(), Self::Error>;
async fn pop_tags(&self, tags: &[&str]) -> Result<(), Self::Error>;
}