QueryCacheEntry<T> class

A single cached query record containing fetched data, timestamps, and TTL settings.

Encapsulates the normalized key, cached data payload, last updatedAt timestamp, and TTL durations (staleTime, cacheTime).

Example:

final entry = QueryCacheEntry<List<String>>(
  key: ['posts', 'featured'],
  data: ['Post 1', 'Post 2'],
  updatedAt: DateTime.now(),
  staleTime: const Duration(minutes: 2),
);

Constructors

QueryCacheEntry({required List key, T? data, required DateTime updatedAt, Duration staleTime = const Duration(minutes: 5), Duration cacheTime = const Duration(minutes: 30), bool isStale = false})
Creates a QueryCacheEntry record.

Properties

cacheTime Duration
Maximum duration to keep this entry in memory before garbage collection.
getter/setter pair
data ↔ T?
Cached data payload.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isExpired bool
Whether this cache entry has exceeded its cacheTime lifetime and should be evicted.
no setter
isStale bool
Whether this entry has been explicitly invalidated or marked stale.
getter/setter pair
key List
Normalized key list uniquely identifying this query.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldRevalidate bool
Whether this cache entry is stale and should be revalidated on access.
no setter
staleTime Duration
Duration after which data is considered stale and background revalidation should occur.
getter/setter pair
updatedAt DateTime
Timestamp when this entry was last fetched or updated.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited