From bb64b99b78a579cb2f6178011a4cf9366e634438 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Mon, 14 Dec 2020 10:42:22 +0000 Subject: Fixed #29867 -- Added support for storing None value in caches. Many of the cache operations make use of the default argument to the .get() operation to determine whether the key was found in the cache. The default value of the default argument is None, so this results in these operations assuming that None is not stored in the cache when it actually is. Adding a sentinel object solves this issue. Unfortunately the unmaintained python-memcached library does not support a default argument to .get(), so the previous behavior is preserved for the deprecated MemcachedCache backend. --- docs/releases/3.2.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs') diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 5b1969698c..8cd77ffad0 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -681,6 +681,14 @@ Miscellaneous ``UserChangeForm.clean_password()`` is no longer required to return the initial value. +* The ``cache.get_many()``, ``get_or_set()``, ``has_key()``, ``incr()``, + ``decr()``, ``incr_version()``, and ``decr_version()`` cache operations now + correctly handle ``None`` stored in the cache, in the same way as any other + value, instead of behaving as though the key didn't exist. + + Due to a ``python-memcached`` limitation, the previous behavior is kept for + the deprecated ``MemcachedCache`` backend. + .. _deprecated-features-3.2: Features deprecated in 3.2 -- cgit v1.3