pub struct CacheMeta {
pub url: String,
pub fetched_at: DateTime<Utc>,
pub last_used_at: DateTime<Utc>,
pub etag: Option<String>,
pub last_modified: Option<String>,
pub content_sha256: String,
pub size_bytes: u64,
}Expand description
Metadata for a cached file.
Fields§
§url: StringOriginal URL
fetched_at: DateTime<Utc>When the file was fetched
last_used_at: DateTime<Utc>When the file was last used
etag: Option<String>HTTP ETag header (for conditional GET)
last_modified: Option<String>HTTP Last-Modified header (for conditional GET)
content_sha256: StringSHA256 hash of content
size_bytes: u64File size in bytes
Implementations§
Source§impl CacheMeta
impl CacheMeta
Sourcepub fn new(
url: String,
etag: Option<String>,
last_modified: Option<String>,
content_sha256: String,
size_bytes: u64,
) -> Self
pub fn new( url: String, etag: Option<String>, last_modified: Option<String>, content_sha256: String, size_bytes: u64, ) -> Self
Create a new CacheMeta with current timestamp.
Sourcepub fn check_freshness(&self, max_age_secs: u32) -> CacheAction
pub fn check_freshness(&self, max_age_secs: u32) -> CacheAction
Check if this cache entry is fresh based on max_age.
Returns the appropriate action to take.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CacheMeta
impl<'de> Deserialize<'de> for CacheMeta
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
Auto Trait Implementations§
impl Freeze for CacheMeta
impl RefUnwindSafe for CacheMeta
impl Send for CacheMeta
impl Sync for CacheMeta
impl Unpin for CacheMeta
impl UnwindSafe for CacheMeta
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