Commit Graph

29 Commits

Author SHA1 Message Date
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
Honza Král cb17f7ca22 Fixed #14560 -- Enable HEAD requests to be cached properly. Thanks, codemonkey!
Introducing ability to cache HEAD requests and GET requests separately by
adding the method to the cache key while preserving the functionality that HEAD
requests can use cached reponses generated by a GET request.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14391 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29 01:31:15 +00:00
Russell Keith-Magee 121d2e3678 Fixed #12991 -- Added unittest2 support. Thanks to PaulM for the draft patch, and to Luke, Karen, Justin, Alex, Łukasz Rekucki, and Chuck Harmston for their help testing and reviewing the final patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:55:17 +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 2a0f4fb5da Fixed #14199 -- Added a missing table creation statement in the db cache backend cull implementation, and added tests for cache culling. Thanks to Tim for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13678 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-31 00:44:46 +00:00
Jacob Kaplan-Moss b3a56755d7 Fixed #11012: don't needless convert cache values to unicode.
This means you can now successfully store binary blogs, such as compressed data,
in the cache.

Thanks to Matt Croydon for the final patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12637 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-01 20:11:24 +00:00
Jannis Leidel 284e7e3cbd Refined changes made in r12546 to also respect the request.LANGUAGE_CODE in case the LocaleMiddleware is used to discover the language preference.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12624 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-01 10:19:01 +00:00
Jannis Leidel 2164e138e3 Fixed #5691 - Adds the active language to the cache key. Thanks, Antoni Aloy, Ramiro Morales and Yann Malet.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12546 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 20:45:28 +00:00
Russell Keith-Magee ab828da2b9 Fixed #11623 -- Corrected table name quoting in db cache backend. Thanks to Fraser Nevett for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12410 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-11 12:21:46 +00:00
Russell Keith-Magee 75ab212d12 Fixed #12399 -- Added handling for memcache timeouts longer than 30 days. Thanks to houdinihound for the report, and gciotta for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12408 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-11 12:06:26 +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
Russell Keith-Magee 96658ef2d2 Fixed #12057 -- Corrected regression of caching performance when a model contained a callable default. Thanks to Michael Thornhill for the excellent assistance tracking this problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-29 14:32:01 +00:00
Jacob Kaplan-Moss 16c9df0a76 Fixed #10016: the cache middleware no longer vomits when handed long URLs. Thanks, Matt Croydon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10335 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 18:19:32 +00:00
Russell Keith-Magee 25e1c39bc3 Fixed #10517 -- Corrected cache name for file-based cache tests so that the filename can be valid under Windows. Thanks to Bob Thomas for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10071 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-17 10:40:04 +00:00
Russell Keith-Magee 638dbc3e83 Fixed #6464 -- Added incr() and decr() operations on cache backends. Atomic on Memcache; implemented as a 2 stage retrieve/update on other backends. Includes refactor of the cache tests to ensure all the backends are actually tested, and a fix to the DB cache backend that was discovered as a result. Thanks to Michael Malone for the original patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 13:27:03 +00:00
Jacob Kaplan-Moss b21ea0a836 More be-nice-to-the-buildbot: be better about cleaning up files created by the cache/session tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9224 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-10 21:41:12 +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
Gary Wilson Jr c85c8f8891 Fixed #7919 -- md5 and sha modules are deprecated since Python 2.5, use hashlib module when available. Patch from Karen Tracey.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-02 05:56:57 +00:00
Malcolm Tredinnick fe240b18f6 Removed some completely pointless test changes from [8084], since they were
already being tested. Thank, Marty. /me is dumb. :-(


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8085 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26 04:10:40 +00:00
Malcolm Tredinnick 6f16b5bad2 Fixed #7967 -- Make sure the __contains__ method in the cache backends call the
right has_key() method for the subclass. Patch from Marty Alchin.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26 03:58:31 +00:00
Jacob Kaplan-Moss acfff050ec Fixed #6099: the filebased cache backend now uses md5 hashes of keys instead of sanitized filenames. For good measure, keys are partitioned into subdirectories using the first few bits of the hash. Thanks, sherbang.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6887 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-04 18:03:56 +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 34cc21983c Removed `vary_delim_re` in `django/utils/cache.py` in favor of existing `cc_delim_re` since the latter is more correct in parsing the header (allows whitespace before and after comma separators instead of just after). As a bonus, tests added for `patch_vary_headers()`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-19 03:12:19 +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
Malcolm Tredinnick 2679bc0304 Fixed #4845 -- Fixed some problems with Unicode usage and caching. Thanks,
Jeremy Dunck.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5718 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-16 09:36:10 +00:00
Gary Wilson Jr f6ced03321 Refs #3012 -- Removed iterator from `test_data_types` cache test that I added in [5703]. Iterators cannot be pickled either. Left the rest of [5703] there though since it fixed another issue that was causing the `test_data_types` cache test to fail with the `locmem` cache backend, the fact that functions cannot be copied.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5716 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-16 05:00:18 +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
Malcolm Tredinnick 0839a0046a Fixed #4041 -- Added a __contains__ method to cache backends. Thanks, Gary
Wilson and SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5171 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-08 04:13:46 +00:00
Russell Keith-Magee 97b9ad73b4 Refs #2333 - Modified runtests script to use new testing framework. Migrated existing tests to use Django testing framework. All the 'othertests' have been migrated into 'regressiontests', and converted into doctests/unittests, as appropriate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-27 13:59:47 +00:00