CacheEntry class

Represents a cached entry with metadata.

Each cache entry contains the cached data along with timing information to support TTL (Time To Live) expiration.

Constructors

CacheEntry({required Map<String, dynamic> data, required DateTime timestamp, Duration? ttl})
Creates a cache entry.
CacheEntry.fromJson(Map<String, dynamic> json)
Creates a cache entry from a JSON map.
factory

Properties

data → Map<String, dynamic>
The cached response data.
final
hashCode → int
The hash code for this object.
no setteroverride
isExpired → bool
Checks if this cache entry has expired based on its TTL.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timestamp → DateTime
When this entry was created or last updated.
final
ttl → Duration?
Time-to-live duration. If null, the entry never expires.
final

Methods

copyWith({Map<String, dynamic>? data, DateTime? timestamp, Duration? ttl}) → CacheEntry
Creates a copy of this entry with updated fields.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this cache entry to a JSON-serializable map.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override