Closed pinkasey closed 1 month ago
Max age is in Ms which 3,600,000ms is one hour.
right.
I'm sending it as response header, so that causes me troubles. I assumed maxAge would be in seconds. I see the code now.
I suggest you change the definition of maxAge on version 5.x.x (it is a breaking change) - to seconds instead of milliseconds.
Also - document the units. it's not specified in the docs
(also the 2 other places where you can config it)
TTLs are almost always in MS
Yeah with the exception of DNS TTL values, in almost any other context a TTL would be in Ms not S
The field is called maxAge
, which in the context of http (max-age
directive in Cache-Control
) is measured in seconds.
Honestly, when I start using any field that measures time, I try to understand what units it's expecting, I usually don't make assumptions. This time I failed.
It's your package, and if you don't want the documentation to be clear that's your choice.
Documentation absolutely should be clear on this, while I don't own the package I am still one of the maintainers and completely refactoring the docs is on the todo
https://github.com/strapi-community/strapi-plugin-rest-cache/blob/main/packages/strapi-plugin-rest-cache/server/types/CacheRouteConfig.js
In fact, it has caused me a serious bug in production. A sensible value would be 3600, which is 1 hour, which is what I think the author has intended