Skip to main content

CacheConfig

Trait CacheConfig 

Source
pub trait CacheConfig {
    const STATS: bool = true;
    const EPOCHS: bool = false;
}
Expand description

Configuration trait for Cache.

This trait allows customizing cache behavior through compile-time configuration.

Provided Associated Constants§

Source

const STATS: bool = true

Whether to track statistics for cache performance.

When enabled, the cache tracks hit and miss counts for each key, allowing monitoring of cache performance.

Only enabled when the stats feature is also enabled.

Defaults to true.

Source

const EPOCHS: bool = false

Whether to track epochs for cheap invalidation via Cache::clear.

When enabled, the cache tracks an epoch counter that is incremented on each call to Cache::clear. Entries are considered invalid if their epoch doesn’t match the current epoch, allowing O(1) invalidation of all entries without touching each bucket.

Defaults to false.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§