# Copyright 2021 - 2021 PeopleWare n.v.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

type: string
pattern: 'private, (max-age=120|max-age=31536000, immutable)'
description: >-
  Directs the end-user's browser to cache _mutable_ responses for a short while, on a human time-scale. When returning
  an _immutable_ response, caching can be infinite.


  The value of this header **must** be

  - `private, max-age=120` (2 minutes) if the resource is retrieved with an `now < at`, or without an `at` query
    parameter

  - `private, max-age=31536000, immutable` if the resource is retrieved with an `at <= now`



  See [RFC 7234 Section 5.2.2](https://tools.ietf.org/html/rfc7234#section-5.2.2).


  The `private` directive ensures the response is only cached by the browser's cache ([RFC 7234 Section
  5.2.2.6](https://tools.ietf.org/html/rfc7234#section-5.2.2.6)).


  The `max-age` (1 year) directive when the resource is immutable is a fall-back for clients that do not understand the
  `immutable` directive (see [RFC 8246](https://tools.ietf.org/html/rfc8246), ["Bits Up!", "Cache-Control:
  immutable"](https://bitsup.blogspot.com/2016/05/cache-control-immutable.html)). With most modern browsers, this is
  superfluous.


  Users, on the same computer, on the same browser, will not get fresh data from the service when they ask for the same
  data during this short period, as long as they did not perform an
  [unsafe](https://tools.ietf.org/html/rfc7231#section-4.2.1) HTTP action.
