pub trait CacheProvider {
// Required methods
fn get(
&self,
cache_space: CacheSpace,
key: &str,
app_name: Option<String>,
) -> String;
fn delete(
&self,
cache_space: CacheSpace,
key: &str,
app_name: Option<String>,
);
fn set(
&self,
cache_space: CacheSpace,
key: &str,
value: Value,
app_name: Option<String>,
);
// Provided methods
fn set_with_ttl(
&self,
cache_space: CacheSpace,
key: &str,
value: Value,
app_name: Option<String>,
ttl_secs: u64,
) { ... }
fn get_key_name(
&self,
cache_space: CacheSpace,
key: &str,
app_name: Option<String>,
) -> String { ... }
fn get_value(
&self,
app_name: Option<String>,
value: Value,
) -> CacheValue<Value> { ... }
}Required Methods§
fn get( &self, cache_space: CacheSpace, key: &str, app_name: Option<String>, ) -> String
fn delete(&self, cache_space: CacheSpace, key: &str, app_name: Option<String>)
fn set( &self, cache_space: CacheSpace, key: &str, value: Value, app_name: Option<String>, )
Provided Methods§
Sourcefn set_with_ttl(
&self,
cache_space: CacheSpace,
key: &str,
value: Value,
app_name: Option<String>,
ttl_secs: u64,
)
fn set_with_ttl( &self, cache_space: CacheSpace, key: &str, value: Value, app_name: Option<String>, ttl_secs: u64, )
Set a key with an explicit TTL in seconds. Defaults to set (no expiry) if not overridden.