summaryrefslogtreecommitdiff
path: root/django/core/cache/backends/db.py
AgeCommit message (Collapse)Author
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-03-01Applied Black's 2025 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/25.1.0
2025-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2022-03-24Refs #32365 -- Removed internal uses of utils.timezone.utc alias.Carlton Gibson
Remaining test case ensures that uses of the alias are mapped canonically by the migration writer.
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-12-09Fixed #33340 -- Fixed unquoted column names in queries used by DatabaseCache.Arsa
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.
2021-09-07Refs #33060 -- Ensured cache backends validate keys.Nick Pope
The validate_key() function should be called after make_key() to ensure that the validation is performed on the key that will actually be stored in the cache. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-05-26Fixed #32772 -- Made database cache count size once per set.Michael Lissner
2021-05-12Fixed #32366 -- Updated datetime module usage to recommended approach.Nick Pope
- Replaced datetime.utcnow() with datetime.now(). - Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp(). - Replaced datetime.utctimetuple() with datetime.timetuple(). - Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp().
2021-05-05Fixed #32705 -- Prevented database cache backend from checking .rowcount on ↵ecogels
closed cursor. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-06-22Fixed #31728 -- Fixed cache culling when no key is found for deletion.Guillermo Bonvehí
DatabaseCache._cull implementation could fail if no key was found to perform a deletion in the table. This prevented the new cache key/value from being correctly added.
2019-11-14Fixed #30759 -- Made cache.delete() return whether it succeeded.daniel a rios
Thanks Simon Charette for the review.
2019-01-17Refs #28370 -- Removed support for the context arg of Field.from_db_value() ↵Tim Graham
and Expression.convert_value(). Per deprecation timeline.
2018-08-17Fixed #29626, #29584 -- Added optimized versions of get_many() and ↵oliver
delete_many() for the db cache backend.
2018-07-09Fixed #29550 -- Eased overriding pickle.dumps() protocol in cache backends ↵Simon Charette
and session serializer.
2018-04-27Fixed #27480 -- Added cache.touch().Nicolas Noé
2018-03-13Quoted field names in cache db backend SQL.Hajime Nakagami
On Firebird, 'value' is a reserved word and must be quoted.
2018-02-02Refs #27795 -- Replaced force_bytes() usage in django.core.cache.Jon Dufresne
2017-12-07Refs #23919 -- Replaced super() calls for old-style classes.Nick Pope
2017-07-20Fixed #28370 -- Deprecated the context arg of Field.from_db_value() and ↵Tim Graham
Expression.convert_value(). Unused since a0d166306fbdc41f49e6fadf4ec84b17eb147daa.
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed most of remaining six usageClaude Paroz
Thanks Tim Graham for the review.
2017-01-18Refs #23919 -- Removed six.PY2/PY3 usageClaude Paroz
Thanks Tim Graham for the review.
2015-05-17Refactored datetime handling in the database cache backend.Aymeric Augustin
Took advantage of the new database adapters and converters.
2015-05-17Renamed value_to_db_xxx to adapt_xxxfield_value.Aymeric Augustin
This mirrors convert_xxxfield_value nicely, taking advantage of the adapter/converter terminology which is commonly used by DB-API modules.
2015-05-17Removed global timezone-aware datetime converters.Aymeric Augustin
Refs #23820.
2015-02-20Fixed #24351, #24346 -- Changed the signature of allow_migrate().Loic Bistuer
The new signature enables better support for routing RunPython and RunSQL operations, especially w.r.t. reusable and third-party apps. This commit also takes advantage of the deprecation cycle for the old signature to remove the backward incompatibility introduced in #22583; RunPython and RunSQL won't call allow_migrate() when when the router has the old signature. Thanks Aymeric Augustin and Tim Graham for helping shape up the patch. Refs 22583.
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-10-10Fixed #23625 -- Removed CacheClass shimJaap Roes
2014-02-02Ensure cursors are closed when no longer needed.Michael Manfre
This commit touchs various parts of the code base and test framework. Any found usage of opening a cursor for the sake of initializing a connection has been replaced with 'ensure_connection()'.
2013-11-02More attacking E302 violatorsAlex Gaynor
2013-11-02Fixed #21302 -- Fixed unused imports and import *.Tim Graham
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-26Fixed #21146 - DatabaseCache converts expires to python valueMichael Manfre
DatabaseCache uses raw cursors to bypass the ORM. This prevents it from being used by database backends that require special handling of datetime values. There is no easy way to test this, so no tests added.
2013-05-18Fixed #9595 -- Allow non-expiring cache timeouts.Jacob Burch
Also, streamline the use of 0 and None between cache backends.
2013-03-13Made atomic usable when autocommit is off.Aymeric Augustin
Thanks Anssi for haggling until I implemented this. This change alleviates the need for atomic_if_autocommit. When autocommit is disabled for a database, atomic will simply create and release savepoints, and not commit anything. This honors the contract of not doing any transaction management. This change also makes the hack to allow using atomic within the legacy transaction management redundant. None of the above will work with SQLite, because of a flaw in the design of the sqlite3 library. This is a known limitation that cannot be lifted without unacceptable side effects eg. triggering arbitrary commits.
2013-03-11Fixed #11569 -- Wrapped DatabaseCache._base_set in an atomic block.Aymeric Augustin
The atomic block provides a clean rollback to a savepoint on failed writes. The ticket reported a race condition which I don't know how to test.
2013-03-11Deprecated transaction.commit/rollback_unless_managed.Aymeric Augustin
Since "unless managed" now means "if database-level autocommit", committing or rolling back doesn't have any effect. Restored transactional integrity in a few places that relied on automatically-started transactions with a transitory API.
2013-02-24Fixed #19896 -- Committed after clearing cache in the database.George Song
2013-02-05Fixed #19689 -- Renamed `Model._meta.module_name` to `model_name`.Simon Charette
2012-11-10Fixed #19273 -- Fixed DB cache backend on pg 9.0+ and py3Anssi Kääriäinen
There was a problem caused by Postgres 9.0+ having bytea_output default value of 'hex' and cache backend inserting the content as 'bytes' into a column of type TEXT. Fixed by converting the bytes value to a string before insert.
2012-08-29Replaced many smart_bytes by force_bytesClaude Paroz
In all those occurrences, we didn't care about preserving the lazy status of the strings, but we really wanted to obtain a real bytestring.
2012-08-18[py3] Fixed cache tests.Aymeric Augustin
2012-08-15[py3] Fixed more encoding issues in cache testsClaude Paroz
2012-08-14[py3] Avoided the deprecated base64 interface.Aymeric Augustin
This fixes a deprecation warning under Python 3.
2012-07-22[py3] Switched to Python 3-compatible imports.Aymeric Augustin
xrange/range will be dealt with in a separate commit due to the huge number of changes.
2012-07-05Fixed #18330 - Made cache culling 3rd party db backend friendlyAnssi Kääriäinen
This is Ian Kelly's patch from #15580 with minor modifications.
2011-11-21Fixed #16378. Locmem now uses pickle.HIGHEST_PROTOCOL for better ↵Paul McMillan
compatibility with other hash backends. Thanks aaugustin for the initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17136 bcc190cf-cafb-0310-a4f2-bffc1f526a37