CacheEntry
struct CacheEntryA stored cache entry.
Bodies are owned by the entry so the store can outlive the
handler that produced them. inserted_at_ms is a monotonic
timestamp (milliseconds) the middleware uses to compute age;
callers pass the value at insertion time so the store stays
decoupled from the clock source.
The parsed :class:CacheControl + Vary header value are
carried alongside the wire bytes so the freshness check
(:func:flare.http.cache.is_fresh) and the secondary key
derivation can run without re-parsing on every lookup.
date_ms is the value of the response's Date header at
insertion time (RFC 9110 §6.6.1) — None when the response did
not advertise one, in which case inserted_at_ms stands in
as the response's wire time. Age: accumulation
(RFC 9111 §4.2.3) starts from whichever is set.
Implements Copyable, Movable
- Fields
status: Intheaders: List[Tuple[String, String]]body: List[UInt8]inserted_at_ms: Int64cache_control: CacheControlvary: Stringdate_ms: Optional[Int64]
basic
def basic(status: Int, var headers: List[Tuple[String, String]], var body: List[UInt8], inserted_at_ms: Int64) -> Self Build a CacheEntry with empty/defaulted freshness metadata. Used by callers that don't yet care about RFC 9111 freshness (single-shot tests, naïve middleware wrappers). The :func:Cache middleware builds entries via the explicit constructor with parsed fields.
copy
def copy(self) -> Self