[][src]Trait wasmer_runtime::cache::Cache

pub trait Cache {
    type LoadError: Debug;
    type StoreError: Debug;
    fn load(&self, key: WasmHash) -> Result<Module, Self::LoadError>;
fn load_with_backend(
        &self,
        key: WasmHash,
        backend: Backend
    ) -> Result<Module, Self::LoadError>;
fn store(
        &mut self,
        key: WasmHash,
        module: Module
    ) -> Result<(), Self::StoreError>; }

A generic cache for storing and loading compiled wasm modules.

The wasmer-runtime supplies a naive FileSystemCache api.

Associated Types

type LoadError: Debug

Error type to return when load error occurs

type StoreError: Debug

Error type to return when store error occurs

Loading content...

Required methods

fn load(&self, key: WasmHash) -> Result<Module, Self::LoadError>

loads a module using the default Backend

fn load_with_backend(
    &self,
    key: WasmHash,
    backend: Backend
) -> Result<Module, Self::LoadError>

loads a cached module using a specific Backend

fn store(
    &mut self,
    key: WasmHash,
    module: Module
) -> Result<(), Self::StoreError>

Store a module into the cache with the given key

Loading content...

Implementors

impl Cache for FileSystemCache[src]

type LoadError = CacheError

type StoreError = CacheError

Loading content...