pub struct CacheEntry {
pub key: CacheKey,
pub response_json: String,
pub accessed_graphs: Vec<String>,
pub accessed_predicates: Vec<String>,
pub created_at: Instant,
pub ttl: Duration,
pub hit_count: u64,
}Expand description
A single cached GraphQL response entry.
Fields§
§key: CacheKeyThe cache key associated with this entry.
response_json: StringThe serialised JSON response body.
accessed_graphs: Vec<String>RDF named graph IRIs that were read when producing this response. Used to invalidate the entry when any of these graphs changes.
accessed_predicates: Vec<String>RDF predicates that were accessed — used for finer-grained invalidation.
created_at: InstantWhen this entry was inserted.
ttl: DurationHow long this entry is valid for.
hit_count: u64Number of times this entry has been served from cache.
Implementations§
Source§impl CacheEntry
impl CacheEntry
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true if this entry has lived longer than its TTL.
Sourcepub fn remaining_ttl(&self) -> Duration
pub fn remaining_ttl(&self) -> Duration
Returns how much TTL remains (saturating at zero for expired entries).
Trait Implementations§
Source§impl Clone for CacheEntry
impl Clone for CacheEntry
Auto 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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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