Nick Pope
42dfa97e19
Fixed #33060 -- Added BaseCache.make_and_validate_key() hook.
...
This helper function reduces the amount of duplicated code and makes it
easier to ensure that we always validate the keys.
2021-09-07 11:59:59 +02:00
Nick Pope
b5acb9db75
Fixed #31907 -- Fixed missing validate_key() calls in cache backends.
2020-08-24 09:41:21 +02:00
daniel a rios
efc3e32d6d
Fixed #30759 -- Made cache.delete() return whether it succeeded.
...
Thanks Simon Charette for the review.
2019-11-14 11:14:11 +01:00
Simon Charette
37835883ad
Fixed #29550 -- Eased overriding pickle.dumps() protocol in cache backends and session serializer.
2018-07-09 11:46:55 -04:00
Nicolas Noé
3246ad1065
Fixed #27480 -- Added cache.touch().
2018-04-27 17:48:35 -04:00
Grant Jenks
d38a3169a4
Fixed #28977 -- Changed local-memory cache to use LRU culling.
...
LRU culling turns every read into a kind of write to the cache: cache keys
are moved to the first position in the OrderedDict when they are retrieved.
The RWLock which permitted multiple readers while prioritizing a single
writer is obsolete since all accesses are now writes.
2018-01-24 12:26:19 -05:00
Дилян Палаузов
d7b2aa24f7
Fixed #28982 -- Simplified code with and/or.
2018-01-03 20:12:23 -05:00
Nick Pope
c68f66e014
Refs #23919 -- Replaced super() calls for old-style classes.
2017-12-07 09:10:32 -05:00
Tim Graham
6e4c6281db
Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
...
This reverts commit 550cb3a365
because try/except performs better.
2017-09-07 08:16:21 -04:00
Mads Jensen
550cb3a365
Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().
2017-06-28 14:07:55 -04:00
Claude Paroz
2b281cc35e
Refs #23919 -- Removed most of remaining six usage
...
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01:00
Tim Graham
0ed7d15563
Sorted imports with isort; refs #23860 .
2015-02-06 08:16:28 -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
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
Florian Apolloner
cf7ddc5765
Follow up to e112654fc8
...
Actually comitted the code now :þ
2013-11-23 18:55:28 +01: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
Alex Gaynor
db2727f952
A few cleanups to capture the minimum amount of code in try/except blocks.
2013-07-08 09:26:52 +10:00
ersran9
76ee39ce14
Fixed 20613 - moved pickle loads/dumps outside with self._lock.reader()/writer() blocks
...
Additionaly added pickled=None initially and check for none before
returning in get
2013-07-06 02:09:52 +05:30
Jacob Burch
89955cc35f
Fixed #9595 -- Allow non-expiring cache timeouts.
...
Also, streamline the use of 0 and None between cache backends.
2013-05-18 15:39:42 +02:00
Aymeric Augustin
ca07fda2ef
[py3] Switched to Python 3-compatible imports.
...
xrange/range will be dealt with in a separate commit due to the huge
number of changes.
2012-07-22 09:29:56 +02:00
Claude Paroz
9383a2761c
Removed with_statement imports, useless in Python >= 2.6. Refs #17965 . Thanks jonash for the patch.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17828 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-30 08:02:08 +00:00
Alex Gaynor
e4919f64b0
Clean up the the locmem cache backend and utils.synch by using context managers. Puch prettier.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17152 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-27 04:28:31 +00:00
Carl Meyer
1086a9a845
Fixed #17287 -- Prevented LocMemCache.incr/decr from changing key expiry time. Thanks Ivan Virabyan for report and patch.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17151 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-26 22:27:16 +00:00
Paul McMillan
0506facd86
Fixed #16378 . Locmem now uses pickle.HIGHEST_PROTOCOL for better 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
2011-11-21 22:25:49 +00:00
Adrian Holovaty
a87be3554f
Removed a bunch of Python 2.4 workarounds now that we don't support it. Refs #15702 -- thanks to jonash for the patch. Splitting this over muliple commits to make it more manageable.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15926 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28 01:40:43 +00:00
Russell Keith-Magee
673e6fc7fb
Fixed #11675 -- Added support for the PyLibMC cache library. In order to 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-12-21 15:19:19 +00:00
Russell Keith-Magee
99d247f4cb
Fixed #13795 -- Added a site-wide cache prefix and cache versioning. Thanks to bruth for the patch.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14623 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-19 15:39:35 +00:00
Russell Keith-Magee
1fc7c4aee4
Fixed #14596 -- Light refactoring of the cache backends.
...
* 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
2010-11-02 05:55:08 +00:00
Malcolm Tredinnick
fc26da645a
Add warning when using cache keys that might not work with memcached.
...
This means testing with local dev caches (not memcache) will warn
developers if they are introducing inadvertent importabilities. There is
also the ability to silence the warning if a dev is not planning to use
memcache and knows what they are doing with their keys.
Thanks to Carl Meyer for the patch. Fixed #6447 .
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13766 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-09-12 18:45:26 +00:00
Russell Keith-Magee
5211f48ae3
Fixed #12164 -- Removed the Python 2.3 compatibility imports and workarounds. Thanks to timo and claudep for the patch.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-04 14:00:30 +00:00
Russell Keith-Magee
8e8d4b5888
Fixed #12671 -- Added set_many(), get_many(), and clear() methods to the cache backend interface. Thanks to Jeff Balogh for the report and patch.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12306 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27 08:21:35 +00:00
Jacob Kaplan-Moss
644e98136a
Fixed #9644 : fix a thread sync issue in the locmem cache. Thanks, mrts.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10333 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 17:05:19 +00:00
Malcolm Tredinnick
392f81cba9
Fixed #9626 -- Fixed a deletion race in the locmem cache.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9998 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 09:59:43 +00:00
Malcolm Tredinnick
f6670e1341
Added a return value to the add() method for caches. It's now possible to tell
...
if a call to add() ended up storing something in the cache.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8278 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-10 03:52:21 +00:00
Malcolm Tredinnick
66612ef529
Fixed #6413 -- Fixed a deadlock situation in the locmem culling implementation.
...
Thanks, Joe Holloway.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8090 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26 05:27:59 +00:00
Malcolm Tredinnick
f425cb8caa
Fixe #6131 -- Fixed a problem with expired keys in the locmem cache. Based on a patch from sherbang.
...
In passing, changed the get() method to use a similar style to has_key() and made add() fractionally faster with the same sort of change (only compute time.time() when we really need it).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6904 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-11 01:20:25 +00:00
Malcolm Tredinnick
f6a3b499b8
Fixed #6086 -- Deprecate the "simple" cache backend in favour of "locmem".
...
Thanks, Paul Bissex.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 00:35:14 +00:00
Gary Wilson Jr
900811f401
Fixed #5981 -- Fixed failing regression test when using locmem cache backend. Changed `add` to pickle the value as is done in `set`. Based on patch from mattmcc.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-21 19:54:58 +00:00
Malcolm Tredinnick
714c09b8bd
Fixed #4831 -- Added an "add" cache key method, for parity with memcached's
...
API. This works for all cache backends. Patch from Matt McClanahan.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6572 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-20 15:16:34 +00:00
Gary Wilson Jr
a41c03345e
Changed imports to adhere to PEP 8.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5704 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-15 06:29:45 +00:00
Gary Wilson Jr
ae7f04caab
Fixed #3012 -- Changed the locmem cache backend to use pickle instead of deepcopy to make it compatible with iterators (which cannot be copied). Patch from Sundance.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-15 06:24:54 +00:00
Jacob Kaplan-Moss
17d0bd1512
Fixed a bunch of spurious imports, typos, and other small errors turned up by a pass through PyFlakes. This covers about the first third of the errors.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-21 17:11:13 +00:00
Adrian Holovaty
c5073320a7
Refactored cache from django/core/cache.py into django/core/cache package, with each backend getting a separate module. This keeps things cleaner and uses less memory, because the backend module is only loaded if it's needed.
...
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2378 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-02-24 06:07:01 +00:00