NoSessionOpen
class NoSessionOpen implements RequestPolicyInterface (View source)
A policy allowing delivery of cached pages when there is no session open.
Do not serve cached pages to authenticated users, or to anonymous users when the user's session is non-empty. The user's session may contain status messages from a form submission, the contents of a shopping cart, or other user-specific content that should not be cached and displayed to other users.
Properties
| protected SessionConfigurationInterface | $sessionConfiguration | The session configuration. |
Methods
Constructs a new page cache session policy.
Determines whether delivery of a cached page should be attempted.
Details
__construct(SessionConfigurationInterface $session_configuration)
Constructs a new page cache session policy.
string|null
check(Request $request)
Determines whether delivery of a cached page should be attempted.
Note that the request-policy check runs very early. In particular it is not possible to determine the logged in user. Also the current route match is not yet present when the check runs. Therefore, request-policy checks need to be designed in a way such that they do not depend on any other service and only take in account the information present on the incoming request.
When matching against the request path, special attention is needed to support path prefixes which are often used on multilingual sites.