pub struct CacheExpiryWindow {
pub cached_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
}Expand description
A cache timestamp window.
Fields§
§cached_at: DateTime<Utc>§expires_at: DateTime<Utc>Implementations§
Source§impl CacheExpiryWindow
impl CacheExpiryWindow
Sourcepub fn from_base(cached_at: DateTime<Utc>, ttl: Duration) -> Self
pub fn from_base(cached_at: DateTime<Utc>, ttl: Duration) -> Self
Build a window from an explicit base timestamp and a TTL.
Sourcepub fn is_expired_at(&self, now: DateTime<Utc>) -> bool
pub fn is_expired_at(&self, now: DateTime<Utc>) -> bool
Whether this window is expired at now.
Sourcepub fn is_valid_at(&self, now: DateTime<Utc>) -> bool
pub fn is_valid_at(&self, now: DateTime<Utc>) -> bool
Whether this window is valid at now.
Sourcepub fn cached_at_rfc3339(&self) -> String
pub fn cached_at_rfc3339(&self) -> String
Cached-at timestamp encoded as RFC3339.
Sourcepub fn expires_at_rfc3339(&self) -> String
pub fn expires_at_rfc3339(&self) -> String
Expires-at timestamp encoded as RFC3339.
Trait Implementations§
Source§impl Clone for CacheExpiryWindow
impl Clone for CacheExpiryWindow
Source§fn clone(&self) -> CacheExpiryWindow
fn clone(&self) -> CacheExpiryWindow
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 Debug for CacheExpiryWindow
impl Debug for CacheExpiryWindow
Source§impl PartialEq for CacheExpiryWindow
impl PartialEq for CacheExpiryWindow
Source§fn eq(&self, other: &CacheExpiryWindow) -> bool
fn eq(&self, other: &CacheExpiryWindow) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for CacheExpiryWindow
impl Eq for CacheExpiryWindow
impl StructuralPartialEq for CacheExpiryWindow
Auto Trait Implementations§
impl Freeze for CacheExpiryWindow
impl RefUnwindSafe for CacheExpiryWindow
impl Send for CacheExpiryWindow
impl Sync for CacheExpiryWindow
impl Unpin for CacheExpiryWindow
impl UnsafeUnpin for CacheExpiryWindow
impl UnwindSafe for CacheExpiryWindow
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