kornelski / kornelski/http-cache-semantics

What unit is immutableMinTimeToLive in?

Open
#25 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
260
Forks
34
PR merge metrics
No merged PRs in 30d

Description

The readme says that "`immutableMinTimeToLive` is a number of milliseconds", but it's compared against values which are in seconds (e.g. `Math.max(defaultMinTtl, (expires - dateValue) / 1000)`) and returned from `maxAge` which on other paths returns values in seconds.

In my opinion, the implementation is reasonable so it's the documentation which is wrong; what do you think?

The default value is `24 * 3600 * 1000`, which is either one day or 1,000 days depending on the answer to this question. I don't see anything in the RFC guiding how clients should behave if `max-age` is not set but `immutable` is. Since "hours * seconds * milliseconds" order makes a little more sense than "hours * seconds * days", I'm guessing it was supposed to be one day, in which case the default value is wrong too.

While you're looking at the documentation for this option:

- The link to "per RFC" is dead. I believe at this point you want to link to https://tools.ietf.org/html/rfc8246.
- Please document the default value for this option, whatever you decide it should have been.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README entry for immutableMinTimeToLive and compare it with the implementation expression using Math.max(defaultMinTtl, (expires - dateValue) / 1000) and the maxAge return value. Check RFC 8246 for relevant guidance, then resolve the unit and default before updating the documentation, including the RFC link and explicit default value.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.