pub struct CacheManager { /* private fields */ }Expand description
SHA-256 content-hash deduplication cache backed by SessionStore.
Implementations§
Source§impl CacheManager
impl CacheManager
pub fn new(store: SessionStore, max_size_bytes: u64) -> Self
Sourcepub fn get_or_compress(
&self,
_path: &Path,
content: &[u8],
pipeline: &CompressionPipeline,
) -> Result<CacheResult>
pub fn get_or_compress( &self, _path: &Path, content: &[u8], pipeline: &CompressionPipeline, ) -> Result<CacheResult>
Look up content in the cache.
- On dedup: return
CacheResult::Dedupwith a compact reference token. - On fresh: compress via
pipeline, persist to store, returnCacheResult::Fresh.
Sourcepub fn invalidate(&self, path: &Path) -> Result<()>
pub fn invalidate(&self, path: &Path) -> Result<()>
Invalidate the cache entry for path if its current content is known.
Reads the file at path, computes its hash, and removes the matching
entry from the store. If the file does not exist the call is a no-op.
Auto Trait Implementations§
impl !Freeze for CacheManager
impl !RefUnwindSafe for CacheManager
impl Send for CacheManager
impl !Sync for CacheManager
impl Unpin for CacheManager
impl UnsafeUnpin for CacheManager
impl !UnwindSafe for CacheManager
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