pub struct CachedData<T> {
pub data: T,
pub cached_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
pub dependencies: Vec<CacheDependency>,
pub access_count: u64,
pub last_accessed: DateTime<Utc>,
pub warming_priority: u32,
}
Expand description
Enhanced cached data wrapper with dependency tracking
Fields§
§data: T
§cached_at: DateTime<Utc>
§expires_at: DateTime<Utc>
§dependencies: Vec<CacheDependency>
Dependencies for intelligent invalidation
access_count: u64
Access count for cache warming
last_accessed: DateTime<Utc>
Last access time for TTI calculation
warming_priority: u32
Cache warming priority (higher = more likely to be warmed)
Implementations§
Source§impl<T> CachedData<T>
impl<T> CachedData<T>
pub fn new(data: T, ttl: Duration) -> Self
pub fn new_with_dependencies( data: T, ttl: Duration, dependencies: Vec<CacheDependency>, ) -> Self
pub fn is_expired(&self) -> bool
pub fn is_idle(&self, tti: Duration) -> bool
pub fn record_access(&mut self)
pub fn update_warming_priority(&mut self, priority: u32)
pub fn add_dependency(&mut self, dependency: CacheDependency)
pub fn has_dependency( &self, entity_type: &str, entity_id: Option<&Uuid>, ) -> bool
Trait Implementations§
Source§impl<T: Clone> Clone for CachedData<T>
impl<T: Clone> Clone for CachedData<T>
Source§fn clone(&self) -> CachedData<T>
fn clone(&self) -> CachedData<T>
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 moreSource§impl<T: Debug> Debug for CachedData<T>
impl<T: Debug> Debug for CachedData<T>
Source§impl<'de, T> Deserialize<'de> for CachedData<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for CachedData<T>where
T: Deserialize<'de>,
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<T> Freeze for CachedData<T>where
T: Freeze,
impl<T> RefUnwindSafe for CachedData<T>where
T: RefUnwindSafe,
impl<T> Send for CachedData<T>where
T: Send,
impl<T> Sync for CachedData<T>where
T: Sync,
impl<T> Unpin for CachedData<T>where
T: Unpin,
impl<T> UnwindSafe for CachedData<T>where
T: UnwindSafe,
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 more