You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: ability to have s-maxage cache control headers (#80)
* added a serverExpiresIn header
* added missing comma in specifying cache-control options
* use triple =, not double =, to follow standards
* added tests for s-maxage being added to cache control
* improved description of serverExpiresIn and but removed it from the example of the object definition, since it's an advanced feature
* check for undefined before converting privacy to lowercase to avoid errors
* removed superfluous info from Readme
for a *cache-response-directive* as defined by RFC 2616.
107
107
+`expiresIn` (Default: `undefined`): a value, in seconds, for the *max-age* the
108
108
resource may be cached. When this is set, and `privacy` is not set to `no-cache`,
109
-
then `', max-age=<value>'` will be appended to the `cache-control` header.
109
+
then `', max-age=<value>'` will be appended to the `cache-control` header.
110
110
+`cache` (Default: `abstract-cache.memclient`): an [abstract-cache][acache]
111
111
protocol compliant cache object. Note: the plugin requires a cache instance to
112
112
properly support the ETag mechanism. Therefore, if a falsy value is supplied
113
113
the default will be used.
114
114
+`cacheSegment` (Default: `'fastify-caching'`): segment identifier to use when
115
115
communicating with the cache.
116
+
+`serverExpiresIn` (Default: `undefined`): a value, in seconds, for the length of time the resource is fresh and may be held in a shared cache (e.g. a CDN). Shared caches will ignore max-age when this is specified, though browsers will continue to use max-age. Should be used with expiresIn, not in place of it. When this is set, and `privacy` is set to `public`, then `', s-maxage=<value>'` will be appended to the `cache-control` header.
0 commit comments