Commit 9e442c82 authored by Sean Bleier's avatar Sean Bleier

Merge pull request #99 from gnulnx/jf/delete_many

Jf/delete many
parents e8b93309 4787000c
...@@ -17,4 +17,5 @@ wtracyliu / wtracyliu <https://github.com/wtracyliu> ...@@ -17,4 +17,5 @@ wtracyliu / wtracyliu <https://github.com/wtracyliu>
Florent Messa / thoas <https://github.com/thoas> Florent Messa / thoas <https://github.com/thoas>
Markus Kaiserswerth / mkai <https://github.com/mkai> Markus Kaiserswerth / mkai <https://github.com/mkai>
Michael Lindemuth / mlindemu <https://github.com/mlindemu> Michael Lindemuth / mlindemu <https://github.com/mlindemu>
John Furr / gnulnx <https://github.com/gnulnx>
Christian Pedersen / chripede <https://github.com/chripede> Christian Pedersen / chripede <https://github.com/chripede>
...@@ -34,7 +34,8 @@ class RedisCache(BaseRedisCache): ...@@ -34,7 +34,8 @@ class RedisCache(BaseRedisCache):
def delete_many(self, keys, version=None): def delete_many(self, keys, version=None):
"""Remove multiple keys at once.""" """Remove multiple keys at once."""
versioned_keys = self.make_keys(keys, version=version) versioned_keys = self.make_keys(keys, version=version)
self._delete_many(self.master_client, versioned_keys) if versioned_keys:
self._delete_many(self.master_client, versioned_keys)
def clear(self, version=None): def clear(self, version=None):
"""Flush cache keys. """Flush cache keys.
......
...@@ -358,6 +358,8 @@ class BaseRedisTestCase(SetupMixin): ...@@ -358,6 +358,8 @@ 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"))
self.assertEqual(self.cache.get("key3"), "ham") self.assertEqual(self.cache.get("key3"), "ham")
# Test that passing an empty list fails silently
self.cache.delete_many([])
def test_clear(self): def test_clear(self):
# The cache can be emptied using clear # The cache can be emptied using clear
......
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