diff options
-rw-r--r-- | redis/client.py | 6 | ||||
-rw-r--r-- | tests/server_commands.py | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/redis/client.py b/redis/client.py index 289f120..3f3617c 100644 --- a/redis/client.py +++ b/redis/client.py @@ -592,14 +592,14 @@ class Redis(threading.local): "Returns the type of key ``name``" return self.execute_command('TYPE', name) - def watch(self, name): + def watch(self, *names): """ - Watches the value at key ``name``, or None of the key doesn't exist + Watches the values at keys ``names``, or None if the key doesn't exist """ if self.subscribed: raise RedisError("Can't call 'watch' from a pipeline'") - return self.execute_command('WATCH', name) + return self.execute_command('WATCH', *names) def unwatch(self): """ diff --git a/tests/server_commands.py b/tests/server_commands.py index fa47726..8cae871 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -255,11 +255,13 @@ class ServerCommandsTestCase(unittest.TestCase): def test_watch(self): self.client.set("a", 1) + self.client.set("b", 2) - self.client.watch("a") + self.client.watch("a", "b") pipeline = self.client.pipeline() pipeline.set("a", 2) - self.assertEquals(pipeline.execute(), [True]) + pipeline.set("b", 3) + self.assertEquals(pipeline.execute(), [True, True]) self.client.set("b", 1) self.client.watch("b") |