pub struct CacheEntry {
pub data: Bytes,
pub size: usize,
pub access_count: u64,
pub last_access: Instant,
pub created_at: Instant,
pub expires_at: Option<Instant>,
pub compressed: bool,
pub spatial_info: Option<SpatialInfo>,
}Expand description
Cache entry with metadata
Fields§
§data: BytesCached data
size: usizeEntry size in bytes
access_count: u64Access count for LFU
last_access: InstantLast access time
created_at: InstantCreation time
expires_at: Option<Instant>TTL expiration time
compressed: boolWhether data is compressed
spatial_info: Option<SpatialInfo>Spatial metadata for geospatial caching
Implementations§
Source§impl CacheEntry
impl CacheEntry
Sourcepub fn with_ttl(data: Bytes, compressed: bool, ttl: Duration) -> Self
pub fn with_ttl(data: Bytes, compressed: bool, ttl: Duration) -> Self
Creates a new cache entry with TTL
Sourcepub fn with_spatial_info(
data: Bytes,
compressed: bool,
spatial_info: SpatialInfo,
) -> Self
pub fn with_spatial_info( data: Bytes, compressed: bool, spatial_info: SpatialInfo, ) -> Self
Creates a new cache entry with spatial info
Sourcepub fn record_access(&mut self)
pub fn record_access(&mut self)
Records an access
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Checks if the entry is expired
Sourcepub fn remaining_ttl(&self) -> Option<Duration>
pub fn remaining_ttl(&self) -> Option<Duration>
Returns remaining TTL if set
Trait Implementations§
Source§impl Clone for CacheEntry
impl Clone for CacheEntry
Source§fn clone(&self) -> CacheEntry
fn clone(&self) -> CacheEntry
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 CacheEntry
impl RefUnwindSafe for CacheEntry
impl Send for CacheEntry
impl Sync for CacheEntry
impl Unpin for CacheEntry
impl UnsafeUnpin for CacheEntry
impl UnwindSafe for CacheEntry
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreCreates a shared type from an unshared type.