Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isPrivateRequest example
if
(
!
$response
->headers->
has
(
'Date'
)
)
{
$response
->
setDate
(
\DateTimeImmutable::
createFromFormat
(
'U',
time
(
)
)
)
;
}
$this
->
processResponseBody
(
$request
,
$response
)
;
if
(
$this
->
isPrivateRequest
(
$request
)
&& !
$response
->headers->
hasCacheControlDirective
(
'public'
)
)
{
$response
->
setPrivate
(
)
;
}
elseif
(
$this
->options
[
'default_ttl'
]
> 0 && null ===
$response
->
getTtl
(
)
&& !
$response
->headers->
getCacheControlDirective
(
'must-revalidate'
)
)
{
$response
->
setTtl
(
$this
->options
[
'default_ttl'
]
)
;
}
return
$response
;
}
/** * Checks whether the cache entry is "fresh enough" to satisfy the Request. */
if
(
!
$response
->headers->
has
(
'Date'
)
)
{
$response
->
setDate
(
\DateTimeImmutable::
createFromFormat
(
'U',
time
(
)
)
)
;
}
$this
->
processResponseBody
(
$request
,
$response
)
;
if
(
$this
->
isPrivateRequest
(
$request
)
&& !
$response
->headers->
hasCacheControlDirective
(
'public'
)
)
{
$response
->
setPrivate
(
)
;
}
elseif
(
$this
->options
[
'default_ttl'
]
> 0 && null ===
$response
->
getTtl
(
)
&& !
$response
->headers->
getCacheControlDirective
(
'must-revalidate'
)
)
{
$response
->
setTtl
(
$this
->options
[
'default_ttl'
]
)
;
}
return
$response
;
}
/** * Checks whether the cache entry is "fresh enough" to satisfy the Request. */