pub trait CacheKey:
Hash
+ Eq
+ Send
+ Sync
+ Clone
+ Debug
+ 'static {
const CACHE_NAME: &'static str;
// Required methods
fn matches_source(&self, source_id: &str) -> bool;
fn record_outcome(&self, hit: bool);
}Expand description
A cache key for ResourceCache.
Required Associated Constants§
Sourceconst CACHE_NAME: &'static str
const CACHE_NAME: &'static str
Identifier used as the moka cache name, the trace-log prefix, and the
metric label in Self::record_outcome.
Required Methods§
Sourcefn matches_source(&self, source_id: &str) -> bool
fn matches_source(&self, source_id: &str) -> bool
Whether this key should be wiped when source_id is invalidated.
Sourcefn record_outcome(&self, hit: bool)
fn record_outcome(&self, hit: bool)
Records one hit or miss. Called exactly once per get_or_insert.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".