-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Feature
wasmtime::Config::cache_config
for loading a CacheConfig
from a struct instead of a file.
Benefit
Right now, in order to use the cache, you have to provide a path to a file with the needed configuration.
However, there are cases where the wasmtime is embedded, rather than the CLI, where the cache is still helpful. It would be more convenient to create the configuration programmatically rather than loaded from a file, to allow the application to determine the cache setup based on its own configuration.
Implementation
-
Expose
wasmtime_cache::CacheConfig
fromwasmtime
-
Add setters for
wasmtime_cache::CacheConfig
so individual fields can be configured.
let mut cache_config = wasmtime_cache::CacheConfig::default();
cache_config.with_directory("/path/to/cache");
- Add
cache_config
method to set this config on thewasmtime::Config
let mut config = wasmtime::Config::default();
config.cache_config(cache_config);
Alternatives
Based on the implementation for the method to load from a file, this seems like a straightforward way to allow for a wasmtime user to create their own cache.
If there are other ideas, we could explore those instead.