Liking cljdoc? Tell your friends :D
Clojure only.

yle-clj-common.ring.cache-headers-middleware


wrap-cache-headersclj

(wrap-cache-headers cacheable-uris
                    {:keys [max-age s-maxage] :as options}
                    handler)

Wraps the handler with a middleware which sets the value of Cache-Control header with directives based on options parameter.

You can set either :max-age (defaults to 30) or :s-maxage (no default). If both are provided, only s-maxage is applied (shared caches are supposed to ignore s-maxage if both are present).

The middleware is applied only if:

  • the handler returns status code 404, or
  • the request path matches one of the patterns listed in cacheable-uris parameter

Otherwise, directives no-cache, no-store, must-revalidate are set.

Wraps the handler with a middleware which sets the value of `Cache-Control`
header with directives based on `options` parameter.

You can set either `:max-age` (defaults to 30) or `:s-maxage` (no default).
If both are provided, only s-maxage is applied (shared caches are supposed
to ignore s-maxage if both are present).

The middleware is applied only if:

- the handler returns status code 404, or
- the request path matches one of the patterns listed in `cacheable-uris` parameter

Otherwise, directives `no-cache, no-store, must-revalidate` are set.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close