cache_evaluate
Determine whether a stored HTTP response is fresh enough to serve without revalidation, using RFC 9111 age and freshness rules. Returns serve, revalidate, or miss with rule IDs.
Instructions
Decide whether a stored response may be reused without revalidating. Applies the RFC 9111 age and freshness arithmetic (Date, Age, Cache-Control, Expires, Last-Modified) and returns action serve|revalidate|miss, the age and freshness lifetime in whole seconds, and the rule IDs with their clause references. now is an argument: the cache never reads a clock.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| now | Yes | evaluation instant (YYYY-MM-DDTHH:MM:SSZ or an HTTP-date) | |
| stored | Yes | ||
| request_headers | No | header name -> value | |
| response_headers | No | header name -> value |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| reasons | Yes | ||
| is_fresh | Yes | ||
| current_age | Yes | RFC 9111 section 4.2.3 age, whole seconds | |
| must_revalidate | Yes | ||
| freshness_lifetime | Yes | whole seconds | |
| stale_while_revalidate_window | Yes | whole seconds; 0 when undeclared |