use std::time::Duration;
use async_trait::async_trait;
use super::Error;
#[async_trait]
pub trait Store: Send + Sync + 'static {
async fn get(&self, key: &str) -> Result<Option<Vec<u8>>, Error>;
async fn put(&self, key: &str, value: Vec<u8>, ttl: Option<Duration>) -> Result<(), Error>;
async fn add(&self, key: &str, value: Vec<u8>, ttl: Option<Duration>) -> Result<bool, Error>;
async fn pull(&self, key: &str) -> Result<Option<Vec<u8>>, Error>;
async fn increment(&self, key: &str, amount: i64) -> Result<i64, Error>;
async fn touch(&self, key: &str, ttl: Duration) -> Result<bool, Error>;
async fn forget(&self, key: &str) -> Result<bool, Error>;
async fn flush(&self) -> Result<(), Error>;
async fn acquire_lock(&self, key: &str, owner: &str, ttl: Option<Duration>) -> Result<bool, Error>;
async fn release_lock(&self, key: &str, owner: &str) -> Result<bool, Error>;
async fn force_release_lock(&self, key: &str) -> Result<(), Error>;
async fn refresh_lock(&self, key: &str, owner: &str, ttl: Option<Duration>) -> Result<bool, Error>;
async fn lock_owner(&self, key: &str) -> Result<Option<String>, Error>;
}