pub struct CacheConfig {
pub memory_bytes: usize,
pub disk: Option<DiskCache>,
pub memory_auto: Option<MemoryPolicy>,
pub write_queue_bytes: usize,
pub writers: Option<usize>,
}Expand description
Cache configuration for an Engine.
Fields§
§memory_bytes: usizeIn-memory LRU capacity for inflated entries (0 disables it).
disk: Option<DiskCache>On-disk cache shared across processes.
memory_auto: Option<MemoryPolicy>Treat memory_bytes as a starting point and keep resizing the LRU to
this process’s share of one budget for every resident host the user
runs (MemoryPolicy::share), instead of a fixed capacity.
write_queue_bytes: usizeHeap queued disk writes may hold before new ones are deferred
([WriteJob::defer]); a memory cache’s budget lowers it further.
writers: Option<usize>Disk writer threads (None: CacheConfig::auto_writers).
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub const WRITE_QUEUE: usize
pub const WRITE_QUEUE: usize
Default of CacheConfig::write_queue_bytes. A cold multi-APK sweep
inflates far faster than the writers persist, and each queued job
keeps its DEX bytes or tables alive until written; without a bound the
heap grows with the backlog (tens of GB over a phone’s APKs).
Sourcepub const MAX_AUTO_WRITERS: usize = 4
pub const MAX_AUTO_WRITERS: usize = 4
Most automatic writer threads: writing is I/O, but a deferred L1 write inflates its entry again first.
Sourcepub fn disk_default() -> CacheConfig
pub fn disk_default() -> CacheConfig
Disk cache in the default directory, no in-memory cache (CLI default).
Sourcepub fn resident(memory_bytes: usize) -> CacheConfig
pub fn resident(memory_bytes: usize) -> CacheConfig
Disk cache plus an in-memory LRU of a fixed capacity.
Sourcepub fn auto_writers(cpus: usize) -> usize
pub fn auto_writers(cpus: usize) -> usize
One writer per 8 CPUs, 1..=CacheConfig::MAX_AUTO_WRITERS.