Fixed #17083 -- Allowed sessions to use non-default cache.

This commit is contained in:
Aymeric Augustin 2012-10-30 21:59:23 +01:00
parent 68847135bc
commit 146ed13a11
6 changed files with 48 additions and 6 deletions

View file

@ -1693,6 +1693,16 @@ This is useful if you have multiple Django instances running under the same
hostname. They can use different cookie paths, and each instance will only see
its own session cookie.
.. setting:: SESSION_CACHE_ALIAS
SESSION_CACHE_ALIAS
-------------------
Default: ``default``
If you're using :ref:`cache-based session storage <cached-sessions-backend>`,
this selects the cache to use.
.. setting:: SESSION_COOKIE_SECURE
SESSION_COOKIE_SECURE

View file

@ -299,6 +299,9 @@ Django 1.5 also includes several smaller improvements worth noting:
* RemoteUserMiddleware now forces logout when the REMOTE_USER header
disappears during the same browser session.
* The :ref:`cache-based session backend <cached-sessions-backend>` can store
session data in a non-default cache.
Backwards incompatible changes in 1.5
=====================================

View file

@ -45,6 +45,8 @@ If you want to use a database-backed session, you need to add
Once you have configured your installation, run ``manage.py syncdb``
to install the single database table that stores session data.
.. _cached-sessions-backend:
Using cached sessions
---------------------
@ -62,6 +64,13 @@ sure you've configured your cache; see the :doc:`cache documentation
sessions directly instead of sending everything through the file or
database cache backends.
If you have multiple caches defined in :setting:`CACHES`, Django will use the
default cache. To use another cache, set :setting:`SESSION_CACHE_ALIAS` to the
name of that cache.
.. versionchanged:: 1.5
The :setting:`SESSION_CACHE_ALIAS` setting was added.
Once your cache is configured, you've got two choices for how to store data in
the cache: