Fixed #14624 -- Updated a few outdated references to CacheMiddleware in the transactions topic guide. Thanks to quinode for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
59d5537a6c
commit
63046ec1ee
|
@ -32,13 +32,14 @@ If the view function produces an exception, Django rolls back any pending
|
||||||
transactions.
|
transactions.
|
||||||
|
|
||||||
To activate this feature, just add the ``TransactionMiddleware`` middleware to
|
To activate this feature, just add the ``TransactionMiddleware`` middleware to
|
||||||
your ``MIDDLEWARE_CLASSES`` setting::
|
your :setting:`MIDDLEWARE_CLASSES` setting::
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
|
'django.middleware.cache.UpdateCacheMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.cache.CacheMiddleware',
|
|
||||||
'django.middleware.transaction.TransactionMiddleware',
|
'django.middleware.transaction.TransactionMiddleware',
|
||||||
|
'django.middleware.cache.FetchFromCacheMiddleware',
|
||||||
)
|
)
|
||||||
|
|
||||||
The order is quite important. The transaction middleware applies not only to
|
The order is quite important. The transaction middleware applies not only to
|
||||||
|
@ -46,9 +47,12 @@ view functions, but also for all middleware modules that come after it. So if
|
||||||
you use the session middleware after the transaction middleware, session
|
you use the session middleware after the transaction middleware, session
|
||||||
creation will be part of the transaction.
|
creation will be part of the transaction.
|
||||||
|
|
||||||
An exception is ``CacheMiddleware``, which is never affected. The cache
|
The various cache middlewares are an exception:
|
||||||
middleware uses its own database cursor (which is mapped to its own database
|
:class:`~django.middleware.cache.CacheMiddleware`,
|
||||||
connection internally).
|
:class:`~django.middleware.cache.UpdateCacheMiddleware`, and
|
||||||
|
:class:`~django.middleware.cache.FetchFromCacheMiddleware` are never affected.
|
||||||
|
Even when using database caching, Django's cache backend uses its own
|
||||||
|
database cursor (which is mapped to its own database connection internally).
|
||||||
|
|
||||||
.. _transaction-management-functions:
|
.. _transaction-management-functions:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue