Skip to content

Commit bed3679

Browse files
authored
Merge pull request #3 from koriym/cc
Add CacheControl
2 parents fa128a3 + 15e3b3f commit bed3679

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

src/CacheControl.php

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the Koriym.HttpConstants.
5+
*
6+
* @license http://opensource.org/licenses/MIT MIT
7+
*/
8+
namespace Koriym\HttpConstants;
9+
10+
/**
11+
* Cache control response directive
12+
*/
13+
final class CacheControl
14+
{
15+
/**
16+
* Indicates that the response may be cached by any cache.
17+
*/
18+
const PUBLIC_ = 'public';
19+
20+
/**
21+
* Indicates that the response is intended for a single user and must not be stored by a shared cache. A private cache may store the response.
22+
*/
23+
const PRIVATE_ = 'private';
24+
25+
/**
26+
* Specifies the maximum amount of time a resource will be considered fresh. Contrary to Expires, this directive is relative to the time of the request.
27+
*/
28+
const MAX_AGE = 'max-age';
29+
30+
/**
31+
* Takes precedence over max-age or the Expires header, but it only applies to shared caches (e.g., proxies) and is ignored by a private cache.
32+
*/
33+
const S_MAX_AGE = 's-maxage';
34+
35+
/**
36+
* Forces caches to submit the request to the origin server for validation before releasing a cached copy.
37+
*/
38+
const NO_CACHE = 'no-cache';
39+
40+
/**
41+
* The cache should not store anything about the client request or server response.
42+
*/
43+
const NO_STORE = 'no-store';
44+
45+
/**
46+
* The cache must verify the status of the stale resources before using it and expired ones should not be used.
47+
*/
48+
const MUST_REVALIDATE = 'must-revalidate';
49+
50+
/**
51+
* Same as must-revalidate, but it only applies to shared caches (e.g., proxies) and is ignored by a private cache.
52+
*/
53+
const PROXY_REVALIDATE = 'proxy-revalidate';
54+
55+
/**
56+
* Indicates that the response body will not change over time. (for web browser)
57+
*
58+
* @see http://bitsup.blogspot.com/2016/05/cache-control-immutable.html
59+
*/
60+
const IMMUTABLE = 'immutable';
61+
}

0 commit comments

Comments
 (0)