Struct futures_cache::Cache
source · pub struct Cache { /* private fields */ }
Expand description
Primary cache abstraction.
Can be cheaply cloned and namespaced.
Implementations§
source§impl Cache
impl Cache
sourcepub fn delete_with_ns<N, K>(&self, ns: Option<&N>, key: &K) -> Result<(), Error>where
N: Serialize,
K: Serialize,
pub fn delete_with_ns<N, K>(&self, ns: Option<&N>, key: &K) -> Result<(), Error>where N: Serialize, K: Serialize,
Delete the given key from the specified namespace.
sourcepub fn namespaced<N>(&self, ns: &N) -> Result<Self, Error>where
N: Serialize,
pub fn namespaced<N>(&self, ns: &N) -> Result<Self, Error>where N: Serialize,
Create a namespaced cache.
The namespace must be unique to avoid conflicts.
Each call to this functions will return its own queue for resolving futures.
sourcepub fn insert<K, T>(
&self,
key: K,
age: Duration,
value: &T
) -> Result<(), Error>where
K: Serialize,
T: Serialize,
pub fn insert<K, T>( &self, key: K, age: Duration, value: &T ) -> Result<(), Error>where K: Serialize, T: Serialize,
Insert a value into the cache.
sourcepub fn test<K>(&self, key: K) -> Result<State<()>, Error>where
K: Serialize,
pub fn test<K>(&self, key: K) -> Result<State<()>, Error>where K: Serialize,
Test an entry from the cache.