Skip to main content

AuthzCache

Trait AuthzCache 

Source
pub trait AuthzCache<V: Clone + Send + Sync>: Send + Sync {
    // Required methods
    fn get(&self, key: &str) -> Option<V>;
    fn insert(&self, key: &str, value: V);
    fn invalidate(&self, key: &str);
    fn invalidate_all(&self);
    fn metrics(&self) -> Box<dyn CacheMetrics>;
}
Expand description

Generic cache abstraction for authz resolution caches.

Implementations must be Send + Sync so they can be shared across threads and stored behind Arc.

Required Methods§

Source

fn get(&self, key: &str) -> Option<V>

Look up a cached value by key. Returns None on miss.

Source

fn insert(&self, key: &str, value: V)

Insert a value into the cache.

Source

fn invalidate(&self, key: &str)

Remove a single entry by key.

Source

fn invalidate_all(&self)

Remove all entries from the cache.

Source

fn metrics(&self) -> Box<dyn CacheMetrics>

Get cache performance metrics.

Implementors§