pub struct CacheMetadata {
pub source_path: Option<PathBuf>,
pub source_mtime: Option<SystemTime>,
pub cached_at: SystemTime,
pub ttl: Option<Duration>,
pub size_bytes: usize,
pub compression_ratio: f32,
}Expand description
Cache entry metadata
Fields§
§source_path: Option<PathBuf>Original .apr file path (for invalidation)
source_mtime: Option<SystemTime>Source file modification time (staleness check)
cached_at: SystemTimeCache entry creation time
ttl: Option<Duration>Time-to-live (None = infinite)
size_bytes: usizeEntry size in bytes
compression_ratio: f32Compression ratio achieved
Implementations§
Source§impl CacheMetadata
impl CacheMetadata
Sourcepub fn with_source(self, path: PathBuf, mtime: SystemTime) -> Self
pub fn with_source(self, path: PathBuf, mtime: SystemTime) -> Self
Create with source path
Sourcepub fn with_compression_ratio(self, ratio: f32) -> Self
pub fn with_compression_ratio(self, ratio: f32) -> Self
Set compression ratio
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if entry is expired
Sourcepub fn is_stale(&self, current_mtime: SystemTime) -> bool
pub fn is_stale(&self, current_mtime: SystemTime) -> bool
Check if entry is stale (source modified)
Trait Implementations§
Source§impl Clone for CacheMetadata
impl Clone for CacheMetadata
Source§fn clone(&self) -> CacheMetadata
fn clone(&self) -> CacheMetadata
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 moreAuto Trait Implementations§
impl Freeze for CacheMetadata
impl RefUnwindSafe for CacheMetadata
impl Send for CacheMetadata
impl Sync for CacheMetadata
impl Unpin for CacheMetadata
impl UnsafeUnpin for CacheMetadata
impl UnwindSafe for CacheMetadata
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> 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 more