pub struct CacheStore { /* private fields */ }Expand description
The persistent layered cache.
Implementations§
Source§impl CacheStore
impl CacheStore
Sourcepub fn open(root: &Path, max_bytes: u64) -> Result<Self>
pub fn open(root: &Path, max_bytes: u64) -> Result<Self>
Open (or create) a cache rooted at root with a byte budget.
A corrupt index is tolerated: it is rebuilt empty.
Sourcepub fn lookup(&mut self, key: &CacheKey) -> Option<Vec<u8>>
pub fn lookup(&mut self, key: &CacheKey) -> Option<Vec<u8>>
Look up an artifact; loads it from disk and bumps LRU + hits.
Sourcepub fn contains(&self, key: &CacheKey) -> bool
pub fn contains(&self, key: &CacheKey) -> bool
Whether an artifact is present (without loading).
Sourcepub fn insert(&mut self, key: &CacheKey, data: &[u8]) -> Result<()>
pub fn insert(&mut self, key: &CacheKey, data: &[u8]) -> Result<()>
Insert an artifact (atomic temp + rename).
Sourcepub fn invalidate_from(&mut self, from_layer: u8) -> usize
pub fn invalidate_from(&mut self, from_layer: u8) -> usize
Invalidate entries at layer >= from_layer (e.g. driver update →
invalidate_from(4) keeps layers 1–3).
Sourcepub fn flush_index(&mut self) -> Result<()>
pub fn flush_index(&mut self) -> Result<()>
Persist the index.
Sourcepub fn metrics(&self) -> &CacheMetrics
pub fn metrics(&self) -> &CacheMetrics
Metrics snapshot.
Sourcepub fn bytes_stored(&self) -> u64
pub fn bytes_stored(&self) -> u64
Current byte usage.
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Entry count.
Sourcepub fn index_fingerprint(&self) -> u64
pub fn index_fingerprint(&self) -> u64
Stable identity hash of the whole index (for audits).
Auto Trait Implementations§
impl Freeze for CacheStore
impl RefUnwindSafe for CacheStore
impl Send for CacheStore
impl Sync for CacheStore
impl Unpin for CacheStore
impl UnsafeUnpin for CacheStore
impl UnwindSafe for CacheStore
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
Mutably borrows from an owned value. Read more