Skip to main content

DiscoveryCache

Trait DiscoveryCache 

Source
pub trait DiscoveryCache: Send + Sync {
    // Required methods
    fn get(&self, key: &CacheKey) -> Result<Option<CacheValue>, PathError>;
    fn put(&self, key: CacheKey, value: CacheValue) -> Result<(), PathError>;
    fn invalidate(&self, root: &Path) -> Result<(), PathError>;
    fn clear(&self) -> Result<(), PathError>;
}
Expand description

Trait for discovery result caches.

Required Methods§

Source

fn get(&self, key: &CacheKey) -> Result<Option<CacheValue>, PathError>

Get a cached value by key.

Source

fn put(&self, key: CacheKey, value: CacheValue) -> Result<(), PathError>

Store a value.

Source

fn invalidate(&self, root: &Path) -> Result<(), PathError>

Invalidate all keys whose root equals or is under root.

Source

fn clear(&self) -> Result<(), PathError>

Clear the entire cache.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl DiscoveryCache for MemoryCache

Source§

impl DiscoveryCache for PersistentCache

Available on crate feature persistent-cache only.