Skip to content

Main content

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.

Loading tool…

Description

Compute RFC 9111 corrected initial cache age from explicit same-unit timestamps and Age value; no actual network observation or clock synchronization assumed.

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.

Compute RFC 9111 corrected initial cache age from explicit same-unit timestamps and Age value; no actual network observation or clock synchronization assumed.

When to use this tool

Use this tool to compute RFC 9111 corrected initial cache age from explicit same-unit timestamps and Age value; no actual network observation or clock synchronization assumed.

How to use the tool and how it works

  1. Enter requestTime, responseTime, dateValue, ageValue using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.apparentAge, result.correctedAgeValue, result.correctedInitialAge. Interpret signs, units, ordering and null values using the rules below.

Require responseTime≥requestTime and nonnegative ageValue. apparentAge = max(0,responseTime−dateValue); correctedAgeValue = ageValue+responseTime−requestTime; correctedInitialAge is their maximum.1, 2

Input fieldMeaning and unitsAccepted input
requestTimeRequest-send timestamp in seconds on the common clock origin.Finite number satisfying the stated comparisons.
responseTimeResponse-receive timestamp, at least requestTime, in the same seconds scale.Finite number satisfying the stated comparisons.
dateValueAlready parsed Date timestamp in the same seconds scale.Finite number satisfying the stated comparisons.
ageValueNonnegative supplied Age duration in seconds.Finite number satisfying the stated comparisons.
Output fieldInterpretation
resultObject containing the fields below.
result.apparentAgemax(0,responseTime−dateValue), in seconds.
result.correctedAgeValueageValue+responseTime−requestTime, in seconds.
result.correctedInitialAgeMaximum of apparentAge and correctedAgeValue, in seconds.
json
{
  "input": {
    "requestTime": 10,
    "responseTime": 12,
    "dateValue": 5,
    "ageValue": 3
  },
  "output": {
    "result": {
      "apparentAge": 7,
      "correctedAgeValue": 5,
      "correctedInitialAge": 7
    }
  }
}

Limitations and assumptions

  • All timestamps and Age durations must use seconds for HTTP semantics, with timestamps on a common clock origin. The tool does not parse HTTP dates or correct unsynchronized clocks.
  • 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

  1. RFC 9111: HTTP Caching — RFC Editor

  2. Tool behavior and example: Cache Corrected Initial Age — tool.io

Similar or alternative tools

  • 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.

  • Cache Directive Extension Inventory

    Inventory explicit cache directive names outside a caller-provided known-name bank; no hardcoded current registry or automatic extension semantics.