pub struct MemoryCacheLifecycle {
pub(crate) disk_cache: Option<Arc<DiskCache>>,
}Expand description
The lifecycle hooks of the HttpCache. Responsible for moving data to the disk.
Fields§
§disk_cache: Option<Arc<DiskCache>>Implementations§
Source§impl MemoryCacheLifecycle
impl MemoryCacheLifecycle
pub(crate) fn empty() -> MemoryCacheLifecycle
Trait Implementations§
Source§impl Clone for MemoryCacheLifecycle
impl Clone for MemoryCacheLifecycle
Source§fn clone(&self) -> MemoryCacheLifecycle
fn clone(&self) -> MemoryCacheLifecycle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Lifecycle<CacheKey, Arc<RwLock<Vec<CachedResource>>>> for MemoryCacheLifecycle
impl Lifecycle<CacheKey, Arc<RwLock<Vec<CachedResource>>>> for MemoryCacheLifecycle
type RequestState = ()
Source§fn begin_request(&self) -> Self::RequestState
fn begin_request(&self) -> Self::RequestState
Called before the insert request starts, e.g.: insert, replace.
Source§fn on_evict(
&self,
_state: &mut Self::RequestState,
key: CacheKey,
value: Arc<RwLock<Vec<CachedResource>>>,
)
fn on_evict( &self, _state: &mut Self::RequestState, key: CacheKey, value: Arc<RwLock<Vec<CachedResource>>>, )
Called when an item is evicted. Read more
Source§fn is_pinned(&self, key: &Key, val: &Val) -> bool
fn is_pinned(&self, key: &Key, val: &Val) -> bool
Returns whether the item is pinned. Items that are pinned can’t be evicted.
Note that a pinned item can still be replaced with get_mut, insert, replace and similar APIs. Read more
Source§fn before_evict(&self, state: &mut Self::RequestState, key: &Key, val: &mut Val)
fn before_evict(&self, state: &mut Self::RequestState, key: &Key, val: &mut Val)
Called when a cache item is about to be evicted.
Note that value replacement (e.g. insertions for the same key) won’t call this method. Read more
Source§fn on_evict_cold(&self, state: &mut Self::RequestState, key: Key, val: Val)
fn on_evict_cold(&self, state: &mut Self::RequestState, key: Key, val: Val)
Called when an item is evicted from the cold queue. Read more
Source§fn on_evict_hot(&self, state: &mut Self::RequestState, key: Key, val: Val)
fn on_evict_hot(&self, state: &mut Self::RequestState, key: Key, val: Val)
Called when an item is evicted from the hot queue. Read more
Source§fn end_request(&self, state: Self::RequestState)
fn end_request(&self, state: Self::RequestState)
Called after a request finishes, e.g.: insert, replace. Read more
Auto Trait Implementations§
impl Freeze for MemoryCacheLifecycle
impl !RefUnwindSafe for MemoryCacheLifecycle
impl Send for MemoryCacheLifecycle
impl Sync for MemoryCacheLifecycle
impl Unpin for MemoryCacheLifecycle
impl UnsafeUnpin for MemoryCacheLifecycle
impl !UnwindSafe for MemoryCacheLifecycle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert