pub struct L3DiskCache { /* private fields */ }Expand description
Disk-backed cache manifest with a directory reserved for content blobs.
Implementations§
Source§impl L3DiskCache
impl L3DiskCache
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self>
pub fn open(root: impl AsRef<Path>) -> Result<Self>
Opens a disk cache rooted at root, creating its manifest and blob directories as needed.
Sourcepub fn startup_validate(&self, max_age: Duration, max_bytes: u64)
pub fn startup_validate(&self, max_age: Duration, max_bytes: u64)
Validates the manifest on startup: removes entries older than max_age
and trims the manifest to max_bytes total token budget.
Sourcepub fn get(&self, key: &CacheKey) -> Option<DeliveryEntryV2>
pub fn get(&self, key: &CacheKey) -> Option<DeliveryEntryV2>
Returns an entry from the persisted manifest without loading its blob.
Sourcepub fn insert(&self, entry: DeliveryEntryV2) -> Result<Option<DeliveryEntryV2>>
pub fn insert(&self, entry: DeliveryEntryV2) -> Result<Option<DeliveryEntryV2>>
Persists an entry to the manifest and returns any entry it replaced.
Sourcepub fn remove(&self, key: &CacheKey) -> Result<Option<DeliveryEntryV2>>
pub fn remove(&self, key: &CacheKey) -> Result<Option<DeliveryEntryV2>>
Removes an entry from the manifest and persists the updated manifest.
Sourcepub fn blob_directory(&self) -> &Path
pub fn blob_directory(&self) -> &Path
Returns the directory reserved for content-addressed blobs.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for L3DiskCache
impl Forget for L3DiskCache
impl Freeze for L3DiskCachewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const [CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>] is !null: Freeze,
PhantomData<[CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>]>: Freeze,
impl Move for L3DiskCache
impl Send for L3DiskCachewhere
RawVecInner: Send,
BoxRaw<[CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>]>: Send,
impl Sync for L3DiskCachewhere
RawVecInner: Sync,
BoxRaw<[CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>]>: Sync,
impl Unpin for L3DiskCachewhere
*const u8 is !null: Unpin,
Box<[CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>]>: Unpin,
impl UnsafeUnpin for L3DiskCachewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const [CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>] is !null: UnsafeUnpin,
PhantomData<[CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>]>: UnsafeUnpin,
impl UnwindSafe for L3DiskCachewhere
RawVecInner: UnwindSafe,
BoxRaw<[CachePadded<RwLock<RawRwLock, RawTable<(CacheKey, SharedValue<PersistedCacheEntry>)>>>]>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more