Commit 37c8ec5a authored by Joona Pääkkönen's avatar Joona Pääkkönen

Bugfix: set_many did not set cache key version

parent 2208beac
...@@ -60,7 +60,7 @@ class RedisCache(BaseRedisCache): ...@@ -60,7 +60,7 @@ class RedisCache(BaseRedisCache):
If timeout is given, that timeout will be used for the key; otherwise If timeout is given, that timeout will be used for the key; otherwise
the default cache timeout will be used. the default cache timeout will be used.
""" """
versioned_keys = self.make_keys(data.keys()) versioned_keys = self.make_keys(data.keys(), version=version)
if timeout is None: if timeout is None:
new_data = {} new_data = {}
for key in versioned_keys: for key in versioned_keys:
......
...@@ -349,6 +349,11 @@ class BaseRedisTestCase(SetupMixin): ...@@ -349,6 +349,11 @@ class BaseRedisTestCase(SetupMixin):
self.assertIsNone(self.cache.get("key1")) self.assertIsNone(self.cache.get("key1"))
self.assertIsNone(self.cache.get("key2")) self.assertIsNone(self.cache.get("key2"))
def test_set_many_version(self):
self.cache.set_many({"key1": "spam", "key2": "eggs"}, version=2)
self.assertEqual(self.cache.get("key1", version=2), "spam")
self.assertEqual(self.cache.get("key2", version=2), "eggs")
def test_delete_many(self): def test_delete_many(self):
# Multiple keys can be deleted using delete_many # Multiple keys can be deleted using delete_many
self.cache.set("key1", "spam") self.cache.set("key1", "spam")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment