pub trait CacheHandler<ErrorT: Error + Sync + Send + Debug> {
type CachingError: Error + Sync + Send + Debug;
// Required methods
fn try_get_cache<'life0, 'life1, 'async_trait, T>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Packet<T>>, Error<ErrorT, Self::CachingError>>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn cache_value<'life0, 'life1, 'async_trait, T>(
&'life0 self,
cache_key: &'life1 str,
cache_value: SuccessPacket<T>,
) -> Pin<Box<dyn Future<Output = Result<(), Error<ErrorT, Self::CachingError>>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Required Associated Types§
Required Methods§
Sourcefn try_get_cache<'life0, 'life1, 'async_trait, T>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Packet<T>>, Error<ErrorT, Self::CachingError>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn try_get_cache<'life0, 'life1, 'async_trait, T>(
&'life0 self,
cache_key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Packet<T>>, Error<ErrorT, Self::CachingError>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A method to implement to get a value from the cache It should NOT return an error if the value is not in the cache If the value is not in the cache, it should return Ok(None)
Sourcefn cache_value<'life0, 'life1, 'async_trait, T>(
&'life0 self,
cache_key: &'life1 str,
cache_value: SuccessPacket<T>,
) -> Pin<Box<dyn Future<Output = Result<(), Error<ErrorT, Self::CachingError>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cache_value<'life0, 'life1, 'async_trait, T>(
&'life0 self,
cache_key: &'life1 str,
cache_value: SuccessPacket<T>,
) -> Pin<Box<dyn Future<Output = Result<(), Error<ErrorT, Self::CachingError>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A method to implement to set a value in the cache It should return an error if the value could not be set
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.