Commit Graph

178 Commits

Author SHA1 Message Date
Ville Skyttä 96f97691ad Fixed broken links in docs and comments. 2016-06-15 21:20:23 -04:00
Jon Dufresne 779829662d Fixed #26694 -- Made FileBasedCache.get() reraise non-ENOENT IOErrors. 2016-06-01 15:29:24 -04:00
Jon Dufresne 359be1c870 Fixed #26691 -- Removed checking for a file's existence before deleting.
File operations always raise a ENOENT error when a file doesn't exist.
Checking the file exists before the operation adds a race condition
condition where the file could be removed between operations. As the
operation already raises an error on a missing file, avoid this race and
avoid checking the file exists twice. Instead only check a file exists
by catching the ENOENT error.
2016-05-31 12:03:27 -04:00
Tim Graham df8d8d4292 Fixed E128 flake8 warnings in django/. 2016-04-08 09:51:06 -04:00
Przemysław Suliga 90ce5d46bf Fixed #26462 -- Fixed Python 2 UnicodeEncodeError when warning about long cache keys. 2016-04-05 11:16:04 -04:00
Przemysław Suliga d356bb653f Fixed #26460 -- Issued a single warning for invalid cache key 2016-04-04 15:20:55 -04:00
Przemysław Suliga 96ec67a7cf Fixed #26332 -- Fixed a race condition in BaseCache.get_or_set(). 2016-03-08 11:44:37 -05:00
userimack 60586dd737 Fixed #26125 -- Fixed E731 flake warnings. 2016-01-25 14:23:43 -05:00
Matthew Madurski 7df9aa3a33 Fixed typo in BaseCache.delete_many() docstring. 2015-12-29 20:50:04 -05:00
Emre Yilmaz 8e838d9c86 Fixed #25840 -- Fixed BaseCache.get_or_set() on the DummyCache backend.
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-12-04 12:22:17 -05:00
Jaap Roes 1aba0e4c68 Refs #25501 -- Fixed a typo in django/core/cache/backends/filebased.py
The original intent in refs #20536 was to use the highest protocol.
Calling zlib.compress() with a compression level of -1 seems to
fall back to the default level of 6.
2015-11-14 15:10:14 -05:00
Ville Skyttä 3ee18400ae Fixed #25668 -- Misc spelling errors 2015-11-03 11:58:13 +02:00
Andrew Artajos 48888a1a67 Fixed #25501 -- Made the file-based cache backend use the highest pickling protocol. 2015-10-20 13:05:33 -04:00
Tom Christie b02f08e02c Fixed #25034 -- Converted caches ImproperlyConfigured error to a system check. 2015-09-18 07:44:39 -04:00
Matthew Crowson 8615e41586 Fixed typo in django/core/cache/backends/base.py docstring. 2015-09-16 09:29:56 -04:00
Maxime Lorant 5153a3bfdc Fixed #25331 -- Removed trailing blank lines in docstrings. 2015-08-31 17:37:21 -04:00
Karol Duleba b74b94445d Updated Memcached get_backend_timeout() comment. 2015-07-06 10:13:20 -04:00
Tim Graham 7da3923ba0 Sorted imports in __init__.py files. 2015-06-27 11:53:33 -04:00
Aymeric Augustin e2a652fac1 Refactored datetime handling in the database cache backend.
Took advantage of the new database adapters and converters.
2015-05-17 09:40:33 +02:00
Aymeric Augustin 54026f1e8d Renamed value_to_db_xxx to adapt_xxxfield_value.
This mirrors convert_xxxfield_value nicely, taking advantage of the
adapter/converter terminology which is commonly used by DB-API modules.
2015-05-17 09:39:34 +02:00
Aymeric Augustin ec186572e6 Removed global timezone-aware datetime converters.
Refs #23820.
2015-05-17 09:36:23 +02:00
Piotr Jakimiak 4157c502a5 Removed unnecessary arguments in .get method calls 2015-05-13 20:51:18 +02:00
Berker Peksag 34fb909180 Fixed #12982 -- Added a get_or_set() method to the BaseCache backend. 2015-03-14 20:07:16 +02:00
Loic Bistuer bed504d70b Fixed #24351, #24346 -- Changed the signature of allow_migrate().
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-20 21:34:09 +07:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Tim Graham 40d6b376d4 Removed BaseMemcachedCacheMethods._get_memcache_timeout backwards compatibility shim.
Per deprecation timeline; refs #21147.
2015-01-17 19:32:54 -05:00
Tim Graham d038c547b5 Removed django.core.cache.get_cache() per deprecation timeline; refs #21012. 2015-01-17 09:55:18 -05:00
Michael Manfre bc8abe36ba Fixed #16358 - 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
Thomas Chaumeny 6448dd8335 Fixed #23642 -- Made LocMemCache.incr() thread-safe as documented 2014-10-12 23:47:48 +07:00
Jaap Roes 1b5918f160 Fixed #23625 -- Removed CacheClass shim 2014-10-10 08:43:26 -04:00
Vincent-Vega 4529af9ecf Fixed #22845 -- Correctly handled memcached default timeout value. 2014-06-16 16:34:00 -04:00
Malcolm Box 66880e4cd1 Fixed #22606 -- Locmemcache has_key() failed for infinite cache expiry
Refactored cache expiry logic for Locmemcache to make consistent across
all places where accessed, and correctly handle None as expiry time.
2014-05-09 18:35:07 +02:00
Malcolm Box af5f688392 Fixed #22495 -- Locmem cache.add() failed with infinite timeouts
cache.add() incorrectly succeeded when there was an existing key
with an infinite (None) timeout.
2014-04-23 14:49:46 +02:00
Claude Paroz 210d0489c5 Fixed #21188 -- 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
zedr 6fe22b30e0 Fixed #22085 -- Added a feature for setting non-expiring keys as the default.
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-03-04 21:16:35 +01:00
Berker Peksag 5d263dee30 Fixed #21674 -- Deprecated the import_by_path() function in favor of import_string().
Thanks Aymeric Augustin for the suggestion and review.
2014-02-08 11:12:19 -05:00
Michael Manfre 3ffeb93186 Ensure cursors are closed when no longer needed.
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()'.
2014-02-02 12:47:21 -05:00
Alex Gaynor 83ab04c6d6 flake8 fixes 2013-11-24 21:07:21 -06:00
Florian Apolloner d47f794f8f Properly closed cache connections at the end of the request.
This only affects the new cache api and not the deprecated get_cache.

Refs #21012
2013-11-24 16:23:28 +01:00
Florian Apolloner cf7ddc5765 Follow up to e112654fc8
Actually comitted the code now :þ
2013-11-23 18:55:28 +01:00
Alex Gaynor 0ec712dd11 A handful of flake8 fixes 2013-11-23 08:26:11 -08:00
Curtis Maloney ffc37e2343 Fixed #21012 -- 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 #21012 -- Thread-local caches, like databases.
2013-11-23 15:06:59 +01:00
Tim Graham 536c447820 Fixed a couple flake8 warnings. 2013-11-07 20:10:25 -05:00
Jaap Roes 7be638390e Fixed #20536 -- rewrite of the file based cache backend
* Safer for use in multiprocess environments
 * Better random culling
 * Cache files use less disk space
 * Safer delete behavior

Also fixed #15806, fixed #15825.
2013-11-07 16:12:15 +02:00
Alex Gaynor c347f78cc1 Fixed all E226 violations 2013-11-03 10:08:55 -08: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
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Alex Gaynor 9bf5610890 Start attacking E231 violations 2013-10-24 10:30:03 -07:00
Michael Manfre bf757a2f4d Fixed #21147 -- 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