summaryrefslogtreecommitdiff
path: root/django/core/cache/backends/base.py
AgeCommit message (Collapse)Author
2025-12-19Fixed #36590 -- Made async cache methods use specialized sync versions if ↵eevelweezel
available. Thanks Simon Charette, Sarah Boyce, and Jacob Walls for reviews.
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-07-23Removed double spaces after periods and within phrases.Sarah Boyce
2025-03-01Applied Black's 2025 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/25.1.0
2023-06-28Fixed #34681 -- Optimized memcache_key_warnings().Adam Johnson
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-09-07Fixed #32076 -- Added async methods to BaseCache.Andrew-Chen-Wang
This also makes DummyCache async-compatible.
2021-09-07Fixed #33060 -- Added BaseCache.make_and_validate_key() hook.Nick Pope
This helper function reduces the amount of duplicated code and makes it easier to ensure that we always validate the keys.
2020-12-17Fixed #29867 -- Added support for storing None value in caches.Nick Pope
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-15Fixed typo in django/core/cache/backends/base.py docstring.Abhishek Ghaskata
2020-06-05Fixed #31654 -- Fixed cache key validation messages.Mariusz Felisiak
2020-06-03Fixed CVE-2020-13254 -- Enforced cache key validation in memcached backends.Dan Palmer
2019-11-14Fixed #30759 -- Made cache.delete() return whether it succeeded.daniel a rios
Thanks Simon Charette for the review.
2019-04-24Removed unnecessary assignments in various code.Jon Dufresne
2018-04-27Fixed #27480 -- Added cache.touch().Nicolas Noé
2017-10-10Fixed #28601 -- Prevented cache.get_or_set() from caching None if default is ↵Daniel Tao
a callable that returns None.
2017-09-06Fixed #27318 -- Made cache.set_many() return the list of failed keys.Olivier Tabone
2017-07-14Fixed #28397 -- Removed django.core.exceptions.DjangoRuntimeWarning.Tim Graham
2017-02-21Refs #27656 -- Updated django.core docstring verbs according to PEP 257.Anton Samarchyan
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-07-11Fixed #26792 -- Allowed None for the value of cache.get_or_set().Dmitry S..ky / skype: dvska-at-skype
2016-04-08Fixed E128 flake8 warnings in django/.Tim Graham
2016-04-05Fixed #26462 -- Fixed Python 2 UnicodeEncodeError when warning about long ↵Przemysław Suliga
cache keys.
2016-04-04Fixed #26460 -- Issued a single warning for invalid cache keyPrzemysław Suliga
2016-03-08Fixed #26332 -- Fixed a race condition in BaseCache.get_or_set().Przemysław Suliga
2015-12-29Fixed typo in BaseCache.delete_many() docstring.Matthew Madurski
2015-12-04Fixed #25840 -- Fixed BaseCache.get_or_set() on the DummyCache backend.Emre Yilmaz
This also fixes a possible data eviction race condition between setting and getting a key. Another thread could remove the key before get_and_set() accesses it again. In this case, now the default value will be returned instead of None.
2015-11-03Fixed #25668 -- Misc spelling errorsVille Skyttä
2015-09-16Fixed typo in django/core/cache/backends/base.py docstring.Matthew Crowson
2015-08-31Fixed #25331 -- Removed trailing blank lines in docstrings.Maxime Lorant
2015-05-13Removed unnecessary arguments in .get method callsPiotr Jakimiak
2015-03-14Fixed #12982 -- Added a get_or_set() method to the BaseCache backend.Berker Peksag
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-03-04Fixed #22085 -- Added a feature for setting non-expiring keys as the default.zedr
This feature allows the default `TIMEOUT` Cache argument to be set to `None`, so that cache instances can set a non-expiring key as the default, instead of using the default value of 5 minutes. Previously, this was possible only by passing `None` as an argument to the set() method of objects of type `BaseCache` (and subtypes).
2014-02-08Fixed #21674 -- Deprecated the import_by_path() function in favor of ↵Berker Peksag
import_string(). Thanks Aymeric Augustin for the suggestion and review.
2013-11-03Fixed all E226 violationsAlex Gaynor
2013-10-01Fixed #21147 -- Avoided time.time precision issue with cache backends.Michael Manfre
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-09-10Fixed #20841 -- Added messages to NotImplementedErrorsGregor MacGregor
Thanks joseph at vertstudios.com for the suggestion.
2013-05-18Fixed #9595 -- Allow non-expiring cache timeouts.Jacob Burch
Also, streamline the use of 0 and None between cache backends.
2013-02-04Fixed #17061 -- Factored out importing object from a dotted pathClaude Paroz
Thanks Carl Meyer for the report.
2012-11-11Tweaked cache key creation to avoid strict typing.Aymeric Augustin
This is a provisional change. See #19221 for details.
2012-11-11Merge pull request #218 from mgrouchy/ticket_18582Aymeric Augustin
Fixed #18582 -- Added a no-op close to BaseCache
2012-08-13[py3] Fixed encoding issues in cache key generationClaude Paroz
2012-08-07[py3] Ported django.utils.encoding.Aymeric Augustin
* Renamed smart_unicode to smart_text (but kept the old name under Python 2 for backwards compatibility). * Renamed smart_str to smart_bytes. * Re-introduced smart_str as an alias for smart_text under Python 3 and smart_bytes under Python 2 (which is backwards compatible). Thus smart_str always returns a str objects. * Used the new smart_str in a few places where both Python 2 and 3 want a str.
2012-07-18BaseCache now has a no-op close method as per ticket #18582Mike Grouchy
Also removed the hasattr check when firing request_finished signal for caches with a 'close' method. Should be safe to call `cache.close` everywhere now
2011-07-13Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for ↵Jannis Leidel
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
2010-12-21Fixed #11675 -- Added support for the PyLibMC cache library. In order to ↵Russell Keith-Magee
support this, and clean up some other 1.3 caching additions, this patch also includes some changes to the way caches are defined. This means you can now have multiple caches, in the same way you have multiple databases. A huge thanks to Jacob Burch for the work on the PyLibMC backend, and to Jannis for his work on the cache definition changes. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15005 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-19Fixed #13795 -- Added a site-wide cache prefix and cache versioning. Thanks ↵Russell Keith-Magee
to bruth for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14623 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-02Fixed #14596 -- Light refactoring of the cache backends.Russell Keith-Magee
* Removes some code duplication, * Provides a convenient base class for db-like cache backends * Adds tests for an edge case of culling, * Marks the memcached tests as "skipped", rather than omitting them. Thanks to Jonas H for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14434 bcc190cf-cafb-0310-a4f2-bffc1f526a37