pub struct Cache { /* private fields */ }
cache
only.Expand description
Global configuration for how the cache is managed
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn new(config: CacheConfig) -> Result<Cache, Error>
pub fn new(config: CacheConfig) -> Result<Cache, Error>
Builds a Cache
from the configuration and spawns the cache worker.
If you want to load the cache configuration from a file, use CacheConfig::from_file
.
You can call CacheConfig::new
for the default configuration.
§Errors
Returns an error if the configuration is invalid.
Sourcepub fn from_file(path: Option<&Path>) -> Result<Cache, Error>
pub fn from_file(path: Option<&Path>) -> Result<Cache, Error>
Loads cache configuration specified at path
.
This method will read the file specified by path
on the filesystem and
attempt to load cache configuration from it. This method can also fail
due to I/O errors, misconfiguration, syntax errors, etc. For expected
syntax in the configuration file see the documentation online.
Passing in None
loads cache configuration from the system default path.
This is located, for example, on Unix at $HOME/.config/wasmtime/config.toml
and is typically created with the wasmtime config new
command.
§Errors
This method can fail due to any error that happens when loading the file
pointed to by path
and attempting to load the cache configuration.
Sourcepub fn worker_event_queue_size(&self) -> u64
pub fn worker_event_queue_size(&self) -> u64
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn baseline_compression_level(&self) -> i32
pub fn baseline_compression_level(&self) -> i32
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn optimized_compression_level(&self) -> i32
pub fn optimized_compression_level(&self) -> i32
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn optimized_compression_usage_counter_threshold(&self) -> u64
pub fn optimized_compression_usage_counter_threshold(&self) -> u64
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn cleanup_interval(&self) -> Duration
pub fn cleanup_interval(&self) -> Duration
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn optimizing_compression_task_timeout(&self) -> Duration
pub fn optimizing_compression_task_timeout(&self) -> Duration
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn allowed_clock_drift_for_files_from_future(&self) -> Duration
pub fn allowed_clock_drift_for_files_from_future(&self) -> Duration
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn file_count_soft_limit(&self) -> u64
pub fn file_count_soft_limit(&self) -> u64
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn files_total_size_soft_limit(&self) -> u64
pub fn files_total_size_soft_limit(&self) -> u64
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn file_count_limit_percent_if_deleting(&self) -> u8
pub fn file_count_limit_percent_if_deleting(&self) -> u8
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn files_total_size_limit_percent_if_deleting(&self) -> u8
pub fn files_total_size_limit_percent_if_deleting(&self) -> u8
Returns $setting
.
Panics if the cache is disabled.
Sourcepub fn directory(&self) -> &PathBuf
pub fn directory(&self) -> &PathBuf
Returns path to the cache directory.
Panics if the cache directory is not set.
Sourcepub fn cache_hits(&self) -> usize
pub fn cache_hits(&self) -> usize
Returns the number of cache hits seen so far
Sourcepub fn cache_misses(&self) -> usize
pub fn cache_misses(&self) -> usize
Returns the number of cache misses seen so far
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnwindSafe for Cache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more