1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[1.1.X] Fixed #12399 -- Added handling for memcache timeouts longer than 30 days. Thanks to houdinihound for the report, and gciotta for the patch.

Backport of r12408 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12412 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2010-02-11 13:09:56 +00:00
parent ad08f07722
commit 3792b2cd9f
2 changed files with 36 additions and 2 deletions

View File

@@ -278,6 +278,22 @@ class BaseCacheTests(object):
self.cache.set(key, value)
self.assertEqual(self.cache.get(key), value)
def test_long_timeout(self):
'''
Using a timeout greater than 30 days makes memcached think
it is an absolute expiration timestamp instead of a relative
offset. Test that we honour this convention. Refs #12399.
'''
self.cache.set('key1', 'eggs', 60*60*24*30 + 1) #30 days + 1 second
self.assertEqual(self.cache.get('key1'), 'eggs')
self.cache.add('key2', 'ham', 60*60*24*30 + 1)
self.assertEqual(self.cache.get('key2'), 'ham')
self.cache.set_many({'key3': 'sausage', 'key4': 'lobster bisque'}, 60*60*24*30 + 1)
self.assertEqual(self.cache.get('key3'), 'sausage')
self.assertEqual(self.cache.get('key4'), 'lobster bisque')
class DBCacheTests(unittest.TestCase, BaseCacheTests):
def setUp(self):
management.call_command('createcachetable', 'test_cache_table', verbosity=0, interactive=False)