pub enum CachePolicy {
CacheFirst,
NetworkFirst,
CacheOnly,
NetworkOnly,
StaleWhileRevalidate,
}Expand description
Cache lookup/write policy.
Variants§
CacheFirst
Check cache first, fetch on miss.
NetworkFirst
Always fetch from source, update cache.
CacheOnly
Return cached value only, never fetch.
NetworkOnly
Fetch from source only, don’t use cache.
StaleWhileRevalidate
Return stale data while revalidating.
Implementations§
Source§impl CachePolicy
impl CachePolicy
Sourcepub fn should_check_cache(&self) -> bool
pub fn should_check_cache(&self) -> bool
Check if this policy should check cache.
Sourcepub fn should_fetch(&self) -> bool
pub fn should_fetch(&self) -> bool
Check if this policy should fetch from source.
Sourcepub fn should_update_cache(&self) -> bool
pub fn should_update_cache(&self) -> bool
Check if this policy should update cache.
Trait Implementations§
Source§impl Clone for CachePolicy
impl Clone for CachePolicy
Source§fn clone(&self) -> CachePolicy
fn clone(&self) -> CachePolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CachePolicy
impl Debug for CachePolicy
Source§impl Default for CachePolicy
impl Default for CachePolicy
Source§fn default() -> CachePolicy
fn default() -> CachePolicy
Returns the “default value” for a type. Read more
Source§impl PartialEq for CachePolicy
impl PartialEq for CachePolicy
impl Copy for CachePolicy
impl Eq for CachePolicy
impl StructuralPartialEq for CachePolicy
Auto Trait Implementations§
impl Freeze for CachePolicy
impl RefUnwindSafe for CachePolicy
impl Send for CachePolicy
impl Sync for CachePolicy
impl Unpin for CachePolicy
impl UnwindSafe for CachePolicy
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