mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32193 -- Deprecated MemcachedCache.
This commit is contained in:
@@ -29,6 +29,8 @@ details on these changes.
|
||||
* ``TransactionTestCase.assertQuerysetEqual()` will no longer automatically
|
||||
call ``repr()`` on a queryset when compared to string values.
|
||||
|
||||
* ``django.core.cache.backends.memcached.MemcachedCache`` will be removed.
|
||||
|
||||
.. _deprecation-removed-in-4.0:
|
||||
|
||||
4.0
|
||||
|
||||
@@ -156,9 +156,8 @@ The cache backend to use. The built-in cache backends are:
|
||||
* ``'django.core.cache.backends.dummy.DummyCache'``
|
||||
* ``'django.core.cache.backends.filebased.FileBasedCache'``
|
||||
* ``'django.core.cache.backends.locmem.LocMemCache'``
|
||||
* ``'django.core.cache.backends.memcached.MemcachedCache'``
|
||||
* ``'django.core.cache.backends.memcached.PyLibMCCache'``
|
||||
* ``'django.core.cache.backends.memcached.PyMemcacheCache'``
|
||||
* ``'django.core.cache.backends.memcached.PyLibMCCache'``
|
||||
|
||||
You can use a cache backend that doesn't ship with Django by setting
|
||||
:setting:`BACKEND <CACHES-BACKEND>` to a fully-qualified path of a cache
|
||||
|
||||
@@ -660,3 +660,8 @@ Miscellaneous
|
||||
``TransactionTestCase.assertQuerysetEqual()``, when compared to string
|
||||
values, is deprecated. If you need the previous behavior, explicitly set
|
||||
``transform`` to ``repr``.
|
||||
|
||||
* The ``django.core.cache.backends.memcached.MemcachedCache`` backend is
|
||||
deprecated as ``python-memcached`` has some problems and seems to be
|
||||
unmaintained. Use ``django.core.cache.backends.memcached.PyMemcacheCache``
|
||||
or ``django.core.cache.backends.memcached.PyLibMCCache`` instead.
|
||||
|
||||
@@ -77,18 +77,16 @@ database or filesystem usage.
|
||||
|
||||
After installing Memcached itself, you'll need to install a Memcached
|
||||
binding. There are several Python Memcached bindings available; the
|
||||
three most common are `python-memcached`_, `pylibmc`_, and `pymemcache`_.
|
||||
two supported by Django are `pylibmc`_ and `pymemcache`_.
|
||||
|
||||
.. _`python-memcached`: https://pypi.org/project/python-memcached/
|
||||
.. _`pylibmc`: https://pypi.org/project/pylibmc/
|
||||
.. _`pymemcache`: https://pypi.org/project/pymemcache/
|
||||
|
||||
To use Memcached with Django:
|
||||
|
||||
* Set :setting:`BACKEND <CACHES-BACKEND>` to
|
||||
``django.core.cache.backends.memcached.MemcachedCache``,
|
||||
``django.core.cache.backends.memcached.PyLibMCCache``, or
|
||||
``django.core.cache.backends.memcached.PyMemcacheCache`` (depending on your
|
||||
``django.core.cache.backends.memcached.PyMemcacheCache`` or
|
||||
``django.core.cache.backends.memcached.PyLibMCCache`` (depending on your
|
||||
chosen memcached binding)
|
||||
|
||||
* Set :setting:`LOCATION <CACHES-LOCATION>` to ``ip:port`` values,
|
||||
@@ -97,21 +95,21 @@ To use Memcached with Django:
|
||||
``path`` is the path to a Memcached Unix socket file.
|
||||
|
||||
In this example, Memcached is running on localhost (127.0.0.1) port 11211, using
|
||||
the ``python-memcached`` binding::
|
||||
the ``pymemcache`` binding::
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
}
|
||||
}
|
||||
|
||||
In this example, Memcached is available through a local Unix socket file
|
||||
:file:`/tmp/memcached.sock` using the ``python-memcached`` binding::
|
||||
:file:`/tmp/memcached.sock` using the ``pymemcache`` binding::
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
|
||||
'LOCATION': 'unix:/tmp/memcached.sock',
|
||||
}
|
||||
}
|
||||
@@ -129,7 +127,7 @@ address 172.19.26.240 and 172.19.26.242, both on port 11211::
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
|
||||
'LOCATION': [
|
||||
'172.19.26.240:11211',
|
||||
'172.19.26.242:11211',
|
||||
@@ -143,7 +141,7 @@ on the IP addresses 172.19.26.240 (port 11211), 172.19.26.242 (port 11212), and
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
|
||||
'LOCATION': [
|
||||
'172.19.26.240:11211',
|
||||
'172.19.26.242:11212',
|
||||
@@ -165,6 +163,12 @@ particularly temporary.
|
||||
|
||||
The ``PyMemcacheCache`` backend was added.
|
||||
|
||||
.. deprecated:: 3.2
|
||||
|
||||
The ``MemcachedCache`` backend is deprecated as ``python-memcached`` has
|
||||
some problems and seems to be unmaintained. Use ``PyMemcacheCache`` or
|
||||
``PyLibMCCache`` instead.
|
||||
|
||||
.. _database-caching:
|
||||
|
||||
Database caching
|
||||
@@ -452,19 +456,6 @@ of 60 seconds, and a maximum capacity of 1000 items::
|
||||
}
|
||||
}
|
||||
|
||||
Here's an example configuration for a ``python-memcached`` based backend with
|
||||
an object size limit of 2MB::
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'LOCATION': '127.0.0.1:11211',
|
||||
'OPTIONS': {
|
||||
'server_max_value_length': 1024 * 1024 * 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Here's an example configuration for a ``pylibmc`` based backend that enables
|
||||
the binary protocol, SASL authentication, and the ``ketama`` behavior mode::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user