Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Session Cache Limiting section for NativeSessionStorage #4728

Merged
merged 1 commit into from
May 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions components/http_foundation/session_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,36 @@ method.

For the sake of clarity, some key options are explained in this documentation.

Session Cache Limiting
~~~~~~~~~~~~~~~~~~~~~~

To avoid users seeing stale data, it's common for session-enabled resources to be
sent with headers that disable caching. For this purpose PHP Sessions has the
``sessions.cache_limiter`` option, which determines which headers, if any, will be
sent with the response when the session in started.

Upon construction,
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage`
sets this global option to ``""`` (send no headers) in case the developer wishes to
use a :class:`Symfony\\Component\\HttpFoundation\\Response` object to manage
response headers.

.. caution::

If you rely on PHP Sessions to manage HTTP caching, you *must* manually set the
``cache_limiter`` option in
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage`
to a non-empty value.

For example, you may set it to PHP's default value during construction:

Example usage::

use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;

$options['cache_limiter'] = session_cache_limiter();
$storage = new NativeSessionStorage($options);

Session Cookie Lifetime
~~~~~~~~~~~~~~~~~~~~~~~

Expand Down