@@ -888,7 +888,7 @@ public function setEtag($etag = null, $weak = false)
888
888
/**
889
889
* Sets the response's cache headers (validation and/or expiration).
890
890
*
891
- * Available options are: etag, last_modified, max_age, s_maxage, private, and public.
891
+ * Available options are: etag, last_modified, max_age, s_maxage, must_revalidate, proxy_revalidate, private, and public.
892
892
*
893
893
* @param array $options An array of cache options
894
894
*
@@ -900,7 +900,7 @@ public function setEtag($etag = null, $weak = false)
900
900
*/
901
901
public function setCache (array $ options )
902
902
{
903
- if ($ diff = array_diff (array_keys ($ options ), array ('etag ' , 'last_modified ' , 'max_age ' , 's_maxage ' , 'private ' , 'public ' ))) {
903
+ if ($ diff = array_diff (array_keys ($ options ), array ('etag ' , 'last_modified ' , 'max_age ' , 's_maxage ' , 'must_revalidate ' , ' proxy_revalidate ' , ' private ' , 'public ' ))) {
904
904
throw new \InvalidArgumentException (sprintf ('Response does not support the following options: "%s". ' , implode ('", " ' , array_values ($ diff ))));
905
905
}
906
906
@@ -920,6 +920,23 @@ public function setCache(array $options)
920
920
$ this ->setSharedMaxAge ($ options ['s_maxage ' ]);
921
921
}
922
922
923
+ if (isset ($ options ['must_revalidate ' ])) {
924
+ if ($ options ['must_revalidate ' ]) {
925
+ $ this ->headers ->addCacheControlDirective ('must-revalidate ' );
926
+ } else {
927
+ $ this ->headers ->removeCacheControlDirective ('must-revalidate ' );
928
+ }
929
+ }
930
+
931
+ if (isset ($ options ['proxy_revalidate ' ])) {
932
+ if ($ options ['proxy_revalidate ' ]) {
933
+ $ this ->setPublic (); // proxy-revalidate doesn't make any sense with private responses
934
+ $ this ->headers ->addCacheControlDirective ('proxy-revalidate ' );
935
+ } else {
936
+ $ this ->headers ->removeCacheControlDirective ('proxy-revalidate ' );
937
+ }
938
+ }
939
+
923
940
if (isset ($ options ['public ' ])) {
924
941
if ($ options ['public ' ]) {
925
942
$ this ->setPublic ();
0 commit comments