wiggle::wasmtime_crate

Trait CacheStore

pub trait CacheStore:
    Send
    + Sync
    + Debug {
    // Required methods
    fn get(&self, key: &[u8]) -> Option<Cow<'_, [u8]>>;
    fn insert(&self, key: &[u8], value: Vec<u8>) -> bool;
}
Expand description

Implementation of an incremental compilation’s key/value cache store.

In theory, this could just be Cranelift’s CacheKvStore trait, but it is not as we want to make sure that wasmtime isn’t too tied to Cranelift internals (and as a matter of fact, we can’t depend on the Cranelift trait here).

Required Methods§

fn get(&self, key: &[u8]) -> Option<Cow<'_, [u8]>>

Try to retrieve an arbitrary cache key entry, and returns a reference to bytes that were inserted via Self::insert before.

fn insert(&self, key: &[u8], value: Vec<u8>) -> bool

Given an arbitrary key and bytes, stores them in the cache.

Returns false when insertion in the cache failed.

Implementors§