pub trait CacheExt {
// Required methods
fn get<T: DeserializeOwned + Send>(
&self,
key: &str,
) -> impl Future<Output = Option<T>> + Send;
fn set<T: Serialize + Send + Sync>(
&self,
key: &str,
value: &T,
ttl_secs: Option<u64>,
) -> impl Future<Output = ()> + Send;
fn take<T: DeserializeOwned + Send>(
&self,
key: &str,
) -> impl Future<Output = Option<T>> + Send;
}Expand description
Convenience methods for JSON serialization and deserialization.
Required Methods§
Sourcefn get<T: DeserializeOwned + Send>(
&self,
key: &str,
) -> impl Future<Output = Option<T>> + Send
fn get<T: DeserializeOwned + Send>( &self, key: &str, ) -> impl Future<Output = Option<T>> + Send
Reads and deserializes a JSON value from the cache.
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.