summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-09-02 19:59:45 -0400
committerTim Graham <timograham@gmail.com>2017-09-22 12:51:17 -0400
commite47b56d791eb6c81c6d83529b7a068959ea1c1ec (patch)
tree9e3dfc877277ecf34351d415e79fa9269e8f26b2
parent87d2240e6cc594a3bf28dfdb2ec023c54fb76ff7 (diff)
Refs #20892 -- Removed support for passing pylibmc behavior settings as top-level attributes of CACHES['OPTIONS'].
Per deprecation timeline.
-rw-r--r--django/core/cache/backends/memcached.py21
-rw-r--r--docs/releases/2.1.txt3
-rw-r--r--docs/topics/cache.txt8
-rw-r--r--tests/cache/tests.py18
4 files changed, 3 insertions, 47 deletions
diff --git a/django/core/cache/backends/memcached.py b/django/core/cache/backends/memcached.py
index d49fd148fd..faaa36306f 100644
--- a/django/core/cache/backends/memcached.py
+++ b/django/core/cache/backends/memcached.py
@@ -3,10 +3,8 @@
import pickle
import re
import time
-import warnings
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
-from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.functional import cached_property
@@ -171,25 +169,6 @@ class PyLibMCCache(BaseMemcachedCache):
import pylibmc
super().__init__(server, params, library=pylibmc, value_not_found_exception=pylibmc.NotFound)
- # The contents of `OPTIONS` was formerly only used to set the behaviors
- # attribute, but is now passed directly to the Client constructor. As such,
- # any options that don't match a valid keyword argument are removed and set
- # under the `behaviors` key instead, to maintain backwards compatibility.
- legacy_behaviors = {}
- for option in list(self._options):
- if option not in ('behaviors', 'binary', 'username', 'password'):
- warnings.warn(
- "Specifying pylibmc cache behaviors as a top-level property "
- "within `OPTIONS` is deprecated. Move `%s` into a dict named "
- "`behaviors` inside `OPTIONS` instead." % option,
- RemovedInDjango21Warning,
- stacklevel=2,
- )
- legacy_behaviors[option] = self._options.pop(option)
-
- if legacy_behaviors:
- self._options.setdefault('behaviors', {}).update(legacy_behaviors)
-
@cached_property
def _cache(self):
return self._lib.Client(self._servers, **self._options)
diff --git a/docs/releases/2.1.txt b/docs/releases/2.1.txt
index 7f1330b756..1fd22da588 100644
--- a/docs/releases/2.1.txt
+++ b/docs/releases/2.1.txt
@@ -236,3 +236,6 @@ how to remove usage of these features.
* ``django.test.runner.setup_databases()`` is removed.
* ``django.utils.translation.string_concat()`` is removed.
+
+* ``django.core.cache.backends.memcached.PyLibMCCache`` no longer supports
+ passing ``pylibmc`` behavior settings as top-level attributes of ``OPTIONS``.
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt
index 6e6564d3e2..16e9a63580 100644
--- a/docs/topics/cache.txt
+++ b/docs/topics/cache.txt
@@ -479,14 +479,6 @@ the binary protocol, SASL authentication, and the ``ketama`` behavior mode::
}
}
-.. versionchanged:: 1.11
-
- Memcached backends can now be configured using ``OPTIONS``.
-
- In older versions, you could pass ``pylibmc`` behavior settings directly
- inside ``OPTIONS``. This is deprecated in favor of setting them under a
- ``behaviors`` key within ``OPTIONS`` instead.
-
.. _the-per-site-cache:
The per-site cache
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index e093dc842d..d3c9513303 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -1308,24 +1308,6 @@ class PyLibMCCacheTests(BaseMemcachedTests, TestCase):
self.assertTrue(cache._cache.binary)
self.assertEqual(cache._cache.behaviors['tcp_nodelay'], int(True))
- @override_settings(CACHES=caches_setting_for_tests(
- base=PyLibMCCache_params,
- exclude=memcached_excluded_caches,
- OPTIONS={'tcp_nodelay': True},
- ))
- def test_pylibmc_legacy_options(self):
- deprecation_message = (
- "Specifying pylibmc cache behaviors as a top-level property "
- "within `OPTIONS` is deprecated. Move `tcp_nodelay` into a dict named "
- "`behaviors` inside `OPTIONS` instead."
- )
- with warnings.catch_warnings(record=True) as warns:
- warnings.simplefilter("always")
- self.assertEqual(cache._cache.behaviors['tcp_nodelay'], int(True))
- self.assertEqual(len(warns), 1)
- self.assertIsInstance(warns[0].message, RemovedInDjango21Warning)
- self.assertEqual(str(warns[0].message), deprecation_message)
-
@override_settings(CACHES=caches_setting_for_tests(
BACKEND='django.core.cache.backends.filebased.FileBasedCache',