CacheEntry class

Cached representation of a rendered page, its metadata snapshot, and headers.

Constructors

CacheEntry({required String html, required WebMetadata metadata, required DateTime createdAt, required Duration ttl, Duration? staleWhileRevalidate, Duration? staleIfError, String? etag, DateTime? lastModified, Set<String>? tags})

Properties

createdAt → DateTime
Generation timestamp.
final
etag → String?
HTTP ETag validator string.
final
hashCode → int
The hash code for this object.
no setterinherited
html → String
Rendered HTML markup.
final
lastModified → DateTime?
Origin Last-Modified timestamp.
final
metadata → WebMetadata
Metadata snapshot corresponding to the exact state when the HTML was generated.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
staleIfError → Duration?
RFC 5861 Stale-If-Error window. If an origin error occurs, stale content can be served for this additional duration.
final
staleWhileRevalidate → Duration?
RFC 5861 Stale-While-Revalidate window. While in this window, the stale entry may be served immediately while background regeneration is initiated.
final
tags → Set<String>
Semantic tags for invalidation (e.g. ['products', 'category:rice']).
final
ttl → Duration
Duration during which the entry is considered completely fresh.
final

Methods

isExpired([DateTime? now]) → bool
Returns true if the entry is completely expired and must not be served under normal conditions.
isFresh([DateTime? now]) → bool
Returns true if the entry is within its fresh TTL window.
isStaleIfError([DateTime? now]) → bool
Returns true if the entry is past TTL (and SWR) but still within the Stale-If-Error window.
isStaleWhileRevalidate([DateTime? now]) → bool
Returns true if the entry is stale (past TTL) but within the Stale-While-Revalidate window.
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