Expand description
Serialization trait for cached values.
This module provides the Cacheable trait which defines the serialization
requirements for types that can be stored in cache backends.
§Feature-Dependent Bounds
The trait has different bounds depending on enabled features:
- Default: Requires
Serialize + DeserializeOwned + Send + Sync(serde) rkyv_format: Additionally requires rkyv traits for zero-copy deserialization
§Blanket Implementation
The trait is automatically implemented for all types that satisfy the bounds, so you don’t need to implement it manually. Just derive the required traits:
ⓘ
#[derive(serde::Serialize, serde::Deserialize)]
#[cfg_attr(feature = "rkyv_format", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))]
struct MyCachedData {
value: String,
}
// MyCachedData automatically implements CacheableTraits§
- Cacheable
- Marker trait for types that can be cached.