pub struct Record {
pub value: String,
pub stored_at: OffsetDateTime,
pub expires_at: Option<OffsetDateTime>,
}Expand description
A stored value plus its cache metadata. value is JSON text.
Fields§
§value: String§stored_at: OffsetDateTime§expires_at: Option<OffsetDateTime>Implementations§
Source§impl Record
impl Record
pub fn new(value: impl Into<String>, stored_at: OffsetDateTime) -> Self
pub fn expiring_at(self, expires_at: OffsetDateTime) -> Self
Sourcepub fn is_expired_at(&self, now: OffsetDateTime) -> bool
pub fn is_expired_at(&self, now: OffsetDateTime) -> bool
Whether this record is stale at now. Records without an expiry never are.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Record
impl<'de> Deserialize<'de> for Record
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Record
impl StructuralPartialEq for Record
Auto Trait Implementations§
impl Freeze for Record
impl RefUnwindSafe for Record
impl Send for Record
impl Sync for Record
impl Unpin for Record
impl UnsafeUnpin for Record
impl UnwindSafe for Record
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