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

Fixed #22495 -- Locmem cache.add() failed with infinite timeouts

cache.add() incorrectly succeeded when there was an existing key
with an infinite (None) timeout.
This commit is contained in:
Malcolm Box
2014-04-23 12:06:23 +01:00
committed by Claude Paroz
parent 2ffa6ca73a
commit af5f688392
2 changed files with 5 additions and 2 deletions

View File

@@ -490,6 +490,9 @@ class BaseCacheTests(object):
cache.add('key2', 'ham', None)
self.assertEqual(cache.get('key2'), 'ham')
added = cache.add('key1', 'new eggs', None)
self.assertEqual(added, False)
self.assertEqual(cache.get('key1'), 'eggs')
cache.set_many({'key3': 'sausage', 'key4': 'lobster bisque'}, None)
self.assertEqual(cache.get('key3'), 'sausage')