Struct swc_plugin_runner::cache::PluginModuleCacheInner
source · pub struct PluginModuleCacheInner { /* private fields */ }
Implementations§
source§impl PluginModuleCacheInner
impl PluginModuleCacheInner
pub fn get_fs_cache_root(&self) -> Option<String>
sourcepub fn contains(&self, key: &str) -> bool
pub fn contains(&self, key: &str) -> bool
Check if the cache contains bytes for the corresponding key.
sourcepub fn insert_raw_bytes(&mut self, key: String, value: Vec<u8>)
pub fn insert_raw_bytes(&mut self, key: String, value: Vec<u8>)
Insert raw plugin module bytes into cache does not have compiled wasmer::Module. The bytes stored in this type of cache will return RawPluginModuleBytes. It is strongly recommend to avoid using this type of cache as much as possible, since module compilation time for the wasm is noticeably expensive and caching raw bytes only cuts off the reading time for the plugin module.
sourcepub fn insert_compiled_module_bytes(
&mut self,
key: String,
value: (Store, Module)
)
pub fn insert_compiled_module_bytes( &mut self, key: String, value: (Store, Module) )
Insert already compiled wasmer::Module into cache.
The module stored in this cache will return CompiledPluginModuleBytes,
which costs near-zero time when calling its compile_module
method as
it clones precompiled module directly.
In genearl it is recommended to use either using filesystemcache
store_bytes_from_path
which internally calls this or directly call
this to store compiled module bytes. CompiledModuleBytes provides way to
create it via RawModuleBytes, so there’s no practical reason to
store raw bytes most cases.