Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
willMakeFinalResponseUncacheable example
foreach
(
self::INHERIT_DIRECTIVES
as
$directive
)
{
if
(
false !==
$this
->flagDirectives
[
$directive
]
)
{
$this
->flagDirectives
[
$directive
]
=
$response
->headers->
hasCacheControlDirective
(
$directive
)
;
}
}
$age
=
$response
->
getAge
(
)
;
$this
->age =
max
(
$this
->age,
$age
)
;
if
(
$this
->
willMakeFinalResponseUncacheable
(
$response
)
)
{
$this
->isNotCacheableResponseEmbedded = true;
return
;
}
$isHeuristicallyCacheable
=
$response
->headers->
hasCacheControlDirective
(
'public'
)
;
$maxAge
=
$response
->headers->
hasCacheControlDirective
(
'max-age'
)
?
(int)
$response
->headers->
getCacheControlDirective
(
'max-age'
)
: null;
$this
->
storeRelativeAgeDirective
(
'max-age',
$maxAge
,
$age
,
$isHeuristicallyCacheable
)
;
$sharedMaxAge
=
$response
->headers->
hasCacheControlDirective
(
's-maxage'
)
?
(int)
$response
->headers->
getCacheControlDirective
(
's-maxage'
)
:
$maxAge
;
$this
->
storeRelativeAgeDirective
(
's-maxage',
$sharedMaxAge
,
$age
,
$isHeuristicallyCacheable
)
;
foreach
(
self::INHERIT_DIRECTIVES
as
$directive
)
{
if
(
false !==
$this
->flagDirectives
[
$directive
]
)
{
$this
->flagDirectives
[
$directive
]
=
$response
->headers->
hasCacheControlDirective
(
$directive
)
;
}
}
$age
=
$response
->
getAge
(
)
;
$this
->age =
max
(
$this
->age,
$age
)
;
if
(
$this
->
willMakeFinalResponseUncacheable
(
$response
)
)
{
$this
->isNotCacheableResponseEmbedded = true;
return
;
}
$isHeuristicallyCacheable
=
$response
->headers->
hasCacheControlDirective
(
'public'
)
;
$maxAge
=
$response
->headers->
hasCacheControlDirective
(
'max-age'
)
?
(int)
$response
->headers->
getCacheControlDirective
(
'max-age'
)
: null;
$this
->
storeRelativeAgeDirective
(
'max-age',
$maxAge
,
$age
,
$isHeuristicallyCacheable
)
;
$sharedMaxAge
=
$response
->headers->
hasCacheControlDirective
(
's-maxage'
)
?
(int)
$response
->headers->
getCacheControlDirective
(
's-maxage'
)
:
$maxAge
;
$this
->
storeRelativeAgeDirective
(
's-maxage',
$sharedMaxAge
,
$age
,
$isHeuristicallyCacheable
)
;