Skip to main content

RuntimeCacheControl

Trait RuntimeCacheControl 

Source
pub trait RuntimeCacheControl: Default {
    // Required methods
    fn clear(&mut self);
    fn stats(&self) -> CacheStats;
}
Expand description

Control surface required for backend runtime caches owned by higher-level runtimes.

Backend caches use this trait so higher-level runtimes and executors can clear and inspect the cache without knowing backend-specific entry types.

§Examples

use tenferro_tensor::{CacheStats, RuntimeCacheControl};

let mut cache = ();
assert_eq!(cache.stats(), CacheStats::empty());
cache.clear();
assert_eq!(cache.stats().entries, 0);

Required Methods§

Source

fn clear(&mut self)

Remove every retained cache entry.

Source

fn stats(&self) -> CacheStats

Snapshot retained entries and retained bytes.

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.

Implementations on Foreign Types§

Source§

impl RuntimeCacheControl for ()

Source§

fn clear(&mut self)

Source§

fn stats(&self) -> CacheStats

Implementors§