13
13
14
14
/**
15
15
* Describes the default HTTP cache headers on controllers.
16
+ * Headers defined in the Cache attribute are ignored if they are already set
17
+ * by the controller.
18
+ *
19
+ * @see https://symfony.com/doc/current/http_cache.html#making-your-responses-http-cacheable
16
20
*
17
21
* @author Fabien Potencier <fabien@symfony.com>
18
22
*/
@@ -38,27 +42,46 @@ public function __construct(
38
42
public int |string |null $ smaxage = null ,
39
43
40
44
/**
41
- * Whether the response is public or not.
45
+ * If true, the contents will be stored in a public cache and served to all
46
+ * the next requests.
42
47
*/
43
48
public ?bool $ public = null ,
44
49
45
50
/**
46
- * Whether or not the response must be revalidated.
51
+ * If true, the response is not served stale by a cache in any circumstance
52
+ * without first revalidating with the origin.
47
53
*/
48
54
public bool $ mustRevalidate = false ,
49
55
50
56
/**
51
- * Additional "Vary:"-headers.
57
+ * Set "Vary" header.
58
+ *
59
+ * Example:
60
+ * ['Accept-Encoding', 'User-Agent']
61
+ *
62
+ * @see https://symfony.com/doc/current/http_cache/cache_vary.html
63
+ *
64
+ * @var string[]
52
65
*/
53
66
public array $ vary = [],
54
67
55
68
/**
56
69
* An expression to compute the Last-Modified HTTP header.
70
+ *
71
+ * The expression is evaluated by the ExpressionLanguage component, it
72
+ * receives all the request attributes and the resolved controller arguments.
73
+ *
74
+ * The result of the expression must be a DateTimeInterface.
57
75
*/
58
76
public ?string $ lastModified = null ,
59
77
60
78
/**
61
79
* An expression to compute the ETag HTTP header.
80
+ *
81
+ * The expression is evaluated by the ExpressionLanguage component, it
82
+ * receives all the request attributes and the resolved controller arguments.
83
+ *
84
+ * The result must be a string that will be hashed.
62
85
*/
63
86
public ?string $ etag = null ,
64
87
0 commit comments