pub trait CacheBackend: Send + Sync {
// Required methods
fn get(&self, namespace: &str, key: &str) -> Option<Vec<u8>>;
fn put(
&self,
namespace: &str,
key: &str,
value: Vec<u8>,
ttl: Option<Duration>,
);
fn invalidate(&self, namespace: &str);
}Expand description
A pluggable cache tier. namespace is the cache declaration’s name so
invalidate can flush exactly one cache’s entries. The enterprise injects a
Redis impl of this; the OSS default is InProcessCache.
Required Methods§
fn get(&self, namespace: &str, key: &str) -> Option<Vec<u8>>
fn put(&self, namespace: &str, key: &str, value: Vec<u8>, ttl: Option<Duration>)
Sourcefn invalidate(&self, namespace: &str)
fn invalidate(&self, namespace: &str)
Flush every entry belonging to namespace (an emit on an
invalidate_on: channel triggers this).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".