Skip to main content

MapCache

Trait MapCache 

Source
pub trait MapCache: Send + Sync {
    // Required methods
    fn get(&self, key: &str) -> Option<Arc<TokenizerMap>>;
    fn set(&self, key: &str, map: Arc<TokenizerMap>);
}
Expand description

Pluggable cache for loaded maps. The default is MemoryMapCache.

Implement this trait to plug in IndexedDB, Redis, on-disk storage, etc.

Required Methods§

Source

fn get(&self, key: &str) -> Option<Arc<TokenizerMap>>

Returns the cached map for key, or None.

Source

fn set(&self, key: &str, map: Arc<TokenizerMap>)

Stores map under key.

Implementors§