pub struct PackCache { /* private fields */ }Expand description
Pack cache for storing and retrieving packs locally.
Implementations§
Source§impl PackCache
impl PackCache
Sourcepub fn new() -> RegistryResult<Self>
pub fn new() -> RegistryResult<Self>
Create a new cache with default location.
Default: ~/.assay/cache/packs
Sourcepub async fn get(
&self,
name: &str,
version: &str,
) -> RegistryResult<Option<CacheEntry>>
pub async fn get( &self, name: &str, version: &str, ) -> RegistryResult<Option<CacheEntry>>
Get a cached pack, verifying integrity on read.
Returns None if not cached or expired.
Returns Err if integrity verification fails (caller should evict and re-fetch).
Sourcepub async fn put(
&self,
name: &str,
version: &str,
result: &FetchResult,
registry_url: Option<&str>,
) -> RegistryResult<()>
pub async fn put( &self, name: &str, version: &str, result: &FetchResult, registry_url: Option<&str>, ) -> RegistryResult<()>
Store a pack in the cache.
Sourcepub async fn get_metadata(&self, name: &str, version: &str) -> Option<CacheMeta>
pub async fn get_metadata(&self, name: &str, version: &str) -> Option<CacheMeta>
Get cached metadata without loading content.
Sourcepub async fn get_etag(&self, name: &str, version: &str) -> Option<String>
pub async fn get_etag(&self, name: &str, version: &str) -> Option<String>
Get the ETag for conditional requests.
Sourcepub async fn is_cached(&self, name: &str, version: &str) -> bool
pub async fn is_cached(&self, name: &str, version: &str) -> bool
Check if a pack is cached and not expired.
Sourcepub async fn evict(&self, name: &str, version: &str) -> RegistryResult<()>
pub async fn evict(&self, name: &str, version: &str) -> RegistryResult<()>
Evict a pack from the cache.
Sourcepub async fn clear(&self) -> RegistryResult<()>
pub async fn clear(&self) -> RegistryResult<()>
Clear all cached packs.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PackCache
impl RefUnwindSafe for PackCache
impl Send for PackCache
impl Sync for PackCache
impl Unpin for PackCache
impl UnsafeUnpin for PackCache
impl UnwindSafe for PackCache
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