Description
Sweep explicit stored-response age components at a supplied clock instant, classifying equality with lifetime as stale; no eviction, revalidation or stale-serving authorization.
HTTP caches distinguish storage policy, freshness and validation. Age and freshness lifetime are durations in seconds; an entity tag is an opaque validator that can be marked weak. Vary identifies request fields relevant to representation selection. A focused arithmetic or token check alone does not decide whether a stored response may be reused.
Sweep explicit stored-response age components at a supplied clock instant, classifying equality with lifetime as stale; no eviction, revalidation or stale-serving authorization.
When to use this tool
Use this tool to sweep explicit stored-response age components at a supplied clock instant, classifying equality with lifetime as stale; no eviction, revalidation or stale-serving authorization.
How to use the tool and how it works
- Enter recordsJson, now using the input definitions below. Serialize the JSON text fields in the decoded shape shown below.
- Run the operation. Resolve malformed-input errors before interpreting the result.
- Read result.records. Interpret signs, units, ordering and null values using the rules below.
Require nonnegative initialAge/lifetime and now≥storedAt for each record. Calculate age = initialAge + now−storedAt and fresh = age<lifetime, retaining original age components and IDs.1, 2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| recordsJson | JSON array of {id,initialAge,storedAt,lifetime} records. id is a string; age/lifetime are nonnegative seconds and storedAt is a timestamp in the same scale as now. | Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply. |
| now | Current supplied timestamp, at least every storedAt, in seconds on the same clock origin. | Finite number satisfying the stated comparisons. |
These decoded examples show the structure of the JSON text fields. Supply each as its corresponding serialized JSON string.
{
"recordsJson": [
{
"id": "a",
"initialAge": 2,
"storedAt": 10,
"lifetime": 5
}
]
} | Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.records | Original stored-response components plus calculated age and strict fresh flag. |
{
"input": {
"recordsJson": "[{\"id\":\"a\",\"initialAge\":2,\"storedAt\":10,\"lifetime\":5}]",
"now": 13
},
"output": {
"result": {
"records": [
{
"id": "a",
"initialAge": 2,
"storedAt": 10,
"lifetime": 5,
"age": 5,
"fresh": false
}
]
}
}
} Limitations and assumptions
- Use seconds for HTTP age semantics and a common timestamp origin. Equality is stale; this does not evict entries or authorize stale serving.
- No HTTP exchange, cache store, clock or server is accessed. Header/directive occurrences and timestamps are supplied explicitly. Durations use seconds for HTTP semantics; timestamps must share an origin and unit.
- Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
- Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.
Alternative or Complementary methods
Combine these focused results with the request/response caching rules applicable to the actual exchange. Preserve field occurrences and distinguish freshness calculations, validator comparison and complete cache-reuse authorization.
References
-
RFC 9111: HTTP Caching — RFC Editor
-
Tool behavior and example: Cache Expiration Sweep Records — tool.io
Similar or alternative tools
- Cache Corrected Initial Age
Compute RFC 9111 corrected initial cache age from explicit same-unit timestamps and Age value; no actual network observation or clock synchronization assumed.
- Cache Age Saturation Formatter
Format a nonnegative exact cache Age integer with RFC delta-seconds overflow saturation at 2^31; does not read response timing.