pub trait CacheAble:
Send
+ Sync
+ Sizedwhere
Self: Serialize + for<'de> Deserialize<'de> + 'static,{
// Required method
fn field() -> impl AsRef<str>;
// Provided methods
fn serialized_size_hint(&self) -> Option<usize> { ... }
fn clone_for_serialize(&self) -> Option<Self> { ... }
fn send<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn send_persistent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn send_with_ttl<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn send_nx<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn sync<'life0, 'life1, 'async_trait>(
id: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, CacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn delete<'life0, 'life1, 'async_trait>(
id: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn scan<'life0, 'life1, 'async_trait>(
pattern_suffix: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CacheError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn cache_id(id: &str, cache: &CacheService) -> String { ... }
}Required Methods§
Provided Methods§
fn serialized_size_hint(&self) -> Option<usize>
fn clone_for_serialize(&self) -> Option<Self>
fn send<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn send_persistent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_persistent<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store this value in the cache with no TTL (persistent until explicitly deleted).
fn send_with_ttl<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_nx<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
sync: &'life2 CacheService,
ttl: Option<Duration>,
) -> Pin<Box<dyn Future<Output = Result<bool, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn sync<'life0, 'life1, 'async_trait>(
id: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
id: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<(), CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn scan<'life0, 'life1, 'async_trait>(
pattern_suffix: &'life0 str,
sync: &'life1 CacheService,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CacheError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cache_id(id: &str, cache: &CacheService) -> String
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".