diff options
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | redis/client.py | 4 | ||||
-rw-r--r-- | tests/server_commands.py | 3 |
3 files changed, 8 insertions, 0 deletions
@@ -1,4 +1,5 @@ * 2.4.10 (in development) + * Added the ECHO command for completeness. * Fixed a bug where attempting to subscribe to a PubSub channel of a Redis server that's down would blow out the stack. Fixes #179 and #195. Thanks Ovidiu Predescu for the test case. diff --git a/redis/client.py b/redis/client.py index f752cae..948c1dc 100644 --- a/redis/client.py +++ b/redis/client.py @@ -293,6 +293,10 @@ class StrictRedis(object): return self.execute_command('DEL', *names) __delitem__ = delete + def echo(self, value): + "Echo the string back from the server" + return self.execute_command('ECHO', value) + def flushall(self): "Delete all keys in all databases on the current host" return self.execute_command('FLUSHALL') diff --git a/tests/server_commands.py b/tests/server_commands.py index 771e0b3..819bedf 100644 --- a/tests/server_commands.py +++ b/tests/server_commands.py @@ -81,6 +81,9 @@ class ServerCommandsTestCase(unittest.TestCase): self.assert_(self.client.config_set('dbfilename', rdbname)) self.assertEquals(self.client.config_get()['dbfilename'], rdbname) + def test_echo(self): + self.assertEquals(self.client.echo('foo bar'), 'foo bar') + def test_info(self): self.client['a'] = 'foo' self.client['b'] = 'bar' |