mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
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
This commit is contained in:
10
tests/regressiontests/cache/tests.py
vendored
10
tests/regressiontests/cache/tests.py
vendored
@@ -865,6 +865,16 @@ class LocMemCacheTests(unittest.TestCase, BaseCacheTests):
|
||||
self.assertEqual(mirror_cache.get('value1'), 42)
|
||||
self.assertEqual(other_cache.get('value1'), None)
|
||||
|
||||
def test_incr_decr_timeout(self):
|
||||
"""incr/decr does not modify expiry time (matches memcached behavior)"""
|
||||
key = 'value'
|
||||
_key = self.cache.make_key(key)
|
||||
self.cache.set(key, 1, timeout=self.cache.default_timeout*10)
|
||||
expire = self.cache._expire_info[_key]
|
||||
self.cache.incr(key)
|
||||
self.assertEqual(expire, self.cache._expire_info[_key])
|
||||
self.cache.decr(key)
|
||||
self.assertEqual(expire, self.cache._expire_info[_key])
|
||||
|
||||
# memcached backend isn't guaranteed to be available.
|
||||
# To check the memcached backend, the test settings file will
|
||||
|
||||
Reference in New Issue
Block a user