Commit Graph

71 Commits

Author SHA1 Message Date
Nick Pope bb64b99b78 Fixed -- 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.
2020-12-17 09:57:21 +01:00
Mariusz Felisiak 5ce31d6a71
Fixed -- Deprecated MemcachedCache. 2020-12-09 21:27:32 +01:00
Nick Pope b4d46df5ca Fixed -- Added a cache backend for pymemcache. 2020-09-16 09:40:30 +02:00
Nick Pope a629139425 Refs , Refs -- Added servers configuration hook for memcached backends.
The servers property can be overridden to allow memcached backends to
alter the server configuration prior to it being passed to instantiate
the client. This allows avoidance of documentation for per-backend
differences, e.g. stripping the 'unix:' prefix for pylibmc.
2020-09-02 08:51:17 +02:00
Nick Pope cc1f2c6a19 Refs -- Simplified memcached client instantiation. 2020-09-01 10:51:00 +02:00
Nick Pope b5acb9db75 Fixed -- Fixed missing validate_key() calls in cache backends. 2020-08-24 09:41:21 +02:00
Nick Pope e2013b260a Refs , -- Moved touch() to BaseMemcachedCache. 2020-08-20 09:00:21 +02:00
Nick Pope 0cb0d59b23 Fixed comments related to nonexistent keys for incr()/decr() in memcached backends. 2020-08-20 08:58:50 +02:00
Dan Palmer 2c82414914 Fixed CVE-2020-13254 -- Enforced cache key validation in memcached backends. 2020-06-03 09:24:26 +02:00
daniel a rios efc3e32d6d Fixed -- Made cache.delete() return whether it succeeded.
Thanks Simon Charette for the review.
2019-11-14 11:14:11 +01:00
Jakub Szafrański 0104b5a417 Fixed -- Made cache.get() with default work correctly on PyLibMCCache if None is cached. 2019-02-14 19:57:38 -05:00
Christian Barcenas c9c6c16650 Fixed -- Fixed memcached's get_many() with single-use iterators.
Thanks Guyon Morée for the report.
2018-07-09 10:24:41 -04:00
Nicolas Noé 3246ad1065 Fixed -- Added cache.touch(). 2018-04-27 17:48:35 -04:00
Tim Graham e47b56d791 Refs -- Removed support for passing pylibmc behavior settings as top-level attributes of CACHES['OPTIONS'].
Per deprecation timeline.
2017-09-22 12:51:17 -04:00
Olivier Tabone a027447f56 Fixed -- Made cache.set_many() return the list of failed keys. 2017-09-06 14:38:44 -04:00
Sergey Fedoseev 3633c2a045 Used dict comprehensions in BaseMemcachedCache.get_many() and set_many() for better readability. 2017-09-05 09:14:41 -04:00
Jon Dufresne 2c69824e5a Refs -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Anton Samarchyan 5a6f70b428 Refs -- Updated django.core docstring verbs according to PEP 257. 2017-02-21 11:58:42 -05:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
chillaranand d6eaf7c018 Refs -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Claude Paroz dc8834cad4 Refs -- Removed unneeded force_str calls 2017-01-20 08:44:31 +01:00
Claude Paroz 7b2f2e74ad Refs -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Ed Morley f02dbbe1ae Fixed -- Stopped closing pylibmc connections after each request.
libmemcached manages its own connections, so isn't affected by refs .
2016-09-02 14:44:27 -04:00
Ed Morley d8ef5b0e65 Fixed -- Supported comma delimiter in memcached LOCATION string. 2016-08-31 17:23:41 -04:00
Ed Morley 65ec8fa8ca Fixed -- Allowed configuring memcached client using OPTIONS.
Previously, the MemcachedCache backend ignored `OPTIONS` and
PyLibMCCache used them to set pylibmc behaviors. Both backends now
pass `OPTIONS` as keyword arguments to the client constructors.
2016-08-31 12:50:14 -04:00
Ville Skyttä 96f97691ad Fixed broken links in docs and comments. 2016-06-15 21:20:23 -04:00
userimack 60586dd737 Fixed -- Fixed E731 flake warnings. 2016-01-25 14:23:43 -05:00
Karol Duleba b74b94445d Updated Memcached get_backend_timeout() comment. 2015-07-06 10:13:20 -04:00
Piotr Jakimiak 4157c502a5 Removed unnecessary arguments in .get method calls 2015-05-13 20:51:18 +02:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs . 2015-02-06 08:16:28 -05:00
Tim Graham 40d6b376d4 Removed BaseMemcachedCacheMethods._get_memcache_timeout backwards compatibility shim.
Per deprecation timeline; refs .
2015-01-17 19:32:54 -05:00
Michael Manfre bc8abe36ba Fixed - Made memcache backend delete old value on a failure to set.
Default Memcached configuration allows for a maximum object of 1MB and
will fail to set the key if it is too large. The key will be deleted from
memcached if it fails to be set. This is needed to avoid an issue with
cache_db session backend using the old value stored in memcached, instead
of the newer value stored in the database.
2014-11-13 00:46:03 -05:00
Vincent-Vega 4529af9ecf Fixed -- Correctly handled memcached default timeout value. 2014-06-16 16:34:00 -04:00
Claude Paroz 210d0489c5 Fixed -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Curtis Maloney ffc37e2343 Fixed -- New API to access cache backends.
Thanks Curtis Malony and Florian Apolloner.

Squashed commit of the following:

commit 3380495e93
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 14:18:07 2013 +0100

    Looked up the template_fragments cache at runtime.

commit 905a74f52b
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 14:19:48 2013 +0100

    Removed all uses of create_cache.

    Refactored the cache tests significantly.

    Made it safe to override the CACHES setting.

commit 35e289fe92
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 12:23:57 2013 +0100

    Removed create_cache function.

commit 8e274f747a
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sat Nov 23 12:04:52 2013 +0100

    Updated docs to describe a simplified cache backend API.

commit ee7eb0f73e
Author: Curtis Maloney <curtis@tinbrain.net>
Date:   Sat Oct 19 09:49:24 2013 +1100

    Fixed  -- Thread-local caches, like databases.
2013-11-23 15:06:59 +01:00
coagulant 3bc0d46a84 Fixed all E261 warnings 2013-11-02 18:20:39 -04:00
Alex Gaynor 7548aa8ffd More attacking E302 violators 2013-11-02 13:12:09 -07:00
Michael Manfre bf757a2f4d Fixed -- Avoided time.time precision issue with cache backends.
The precision of time.time() is OS specific and it is possible for the
resolution to be low enough to allow reading a cache key previously set
with a timeout of 0.
2013-10-01 13:42:59 -04:00
Tim Graham 3c736207a3 Fixed -- Fixed MemcachedCache backend get_many on Python 3. 2013-07-09 11:55:45 -04:00
Jacob Burch 89955cc35f Fixed -- Allow non-expiring cache timeouts.
Also, streamline the use of 0 and None between cache backends.
2013-05-18 15:39:42 +02:00
Bas Peschier 5a9b2bce24 Fixed -- MemcachedCache now uses pickle.HIGHEST_PROTOCOL 2013-02-24 13:56:15 +01:00
Aymeric Augustin 59351247bd Removed django.core.cache.backends.memcached.CacheClass. 2012-12-29 21:59:07 +01:00
Claude Paroz 79dd751b0b Fixed -- Made memcached backend handle negative incr/decr values
Thanks Michael Manfre for the report and initial patch and
Tobias McNulty for the review.
2012-11-06 12:22:42 +01:00
Alex Gaynor 335a9f9cf1 Removed many uses of bare "except:", which were either going to a) silence real issues, or b) were impossible to hit. 2012-09-07 15:08:07 -04:00
Claude Paroz ae88e73fa6 Replaced some smart_xxx by force_xxx equivalent
smart_str/smart_text should only be used when a potential lazy
string should be preserved in the result of the function call.
2012-08-30 15:46:16 +02:00
Claude Paroz 4e17f4589a Fixed -- memcached cache backend expects byte strings as keys
Thanks thecore for the report.
2012-08-15 16:57:17 +02:00
Aymeric Augustin 3cb2457f46 [py3] Replaced basestring by six.string_types. 2012-07-22 09:29:54 +02:00
Aymeric Augustin e84f79f051 Fixed -- Advanced deprecation warnings.
Thanks Ramiro for the patch.
2012-05-03 15:27:01 +02:00
Jannis Leidel db594f90ba Fixed -- Stopped the memcache cache backend from raising an exception if the timeout value isn't an integer. Thanks, Jeff Balogh.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16556 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-29 09:39:23 +00:00
Jannis Leidel 24f4764a48 Fixed -- Removed unused imports. Many thanks to Aymeric Augustin for the work on the patch and Alex for reviewing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13 09:35:51 +00:00