pub struct DiskCache { /* private fields */ }Expand description
Disk cache rooted at an XDG (or override) directory.
Implementations§
Source§impl DiskCache
impl DiskCache
Sourcepub fn clear(&self) -> AppResult<CacheClearResult>
pub fn clear(&self) -> AppResult<CacheClearResult>
Remove every entry under http/v1 (temps included).
§Errors
Returns crate::error::ErrorKind::Internal when the cache directory cannot
be read.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Inventory of on-disk entries and budget.
Source§impl DiskCache
impl DiskCache
Sourcepub fn put(&self, url: &Url, accept: &str, resp: &HttpResponse) -> AppResult<()>
pub fn put(&self, url: &Url, accept: &str, resp: &HttpResponse) -> AppResult<()>
Persist a successful response. Best-effort; failures are non-fatal at call sites.
§Errors
Returns crate::error::ErrorKind::Internal on filesystem create/write/rename
failures or when cache metadata cannot be serialized.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiskCache
impl RefUnwindSafe for DiskCache
impl Send for DiskCache
impl Sync for DiskCache
impl Unpin for DiskCache
impl UnsafeUnpin for DiskCache
impl UnwindSafe for DiskCache
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