Skip to main content

KvBlobCache

Trait KvBlobCache 

Source
pub trait KvBlobCache: Send + Sync {
    // Required methods
    fn get(&self, key: &str) -> Option<(Bytes, &'static str)>;
    fn put(&self, key: &str, payload: Bytes);
    fn contains(&self, key: &str) -> bool;
    fn clear(&self);

    // Provided method
    fn remove(&self, _key: &str) -> bool { ... }
}
Expand description

Sync-only cache surface used by WombatKVKvStore. Implementations must be Send + Sync because the algorithm crate holds them behind Arc<dyn KvBlobCache>.

Required Methods§

Source

fn get(&self, key: &str) -> Option<(Bytes, &'static str)>

Sync read. Returns (bytes, op_label) on hit; op_label is a short telemetry tag like "load_mmap" or "load_foyer_ram".

Source

fn put(&self, key: &str, payload: Bytes)

Sync write. Caches bytes for subsequent reads.

Source

fn contains(&self, key: &str) -> bool

Sync existence check that does not materialize the payload.

Source

fn clear(&self)

Drop all entries. Best-effort, implementations may leave disk files in place if removing them would race with concurrent readers.

Provided Methods§

Source

fn remove(&self, _key: &str) -> bool

Drop one entry by key. Best-effort: missing files succeed. Returns true if a file was actually removed. Default impl is a no-op so adding remove does not force every existing impl to implement it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§