pub trait ObjectCache<K: Key, V: Value>: Send + Sync {
// Required methods
fn lookup_or_reserve<'a>(&'a self, key: &K) -> ObjectCacheResult<'_, V>;
fn invalidate(&self, key: K, value: Option<V>);
}
Required Methods§
Sourcefn lookup_or_reserve<'a>(&'a self, key: &K) -> ObjectCacheResult<'_, V>
fn lookup_or_reserve<'a>(&'a self, key: &K) -> ObjectCacheResult<'_, V>
Looks up a key in the cache and may return a cached value for it. See ObjectCacheResult
.
Sourcefn invalidate(&self, key: K, value: Option<V>)
fn invalidate(&self, key: K, value: Option<V>)
Removes key from cache if value
is None, invalidates the results of placeholders that have
not been resolved. When value
is provided then the value may be inserted, and may replace
an existing value.