From c0d2a86ca9263fae384c1b201dd0824463b04fc6 Mon Sep 17 00:00:00 2001 From: farshid Date: Sun, 5 Jun 2011 14:06:02 -0700 Subject: [PATCH] added an async_set command added an async_set command this socket channel can only be used for sending messages. if the user tries to run any command which handles the response MemcachedClient will raise an assert because opaque numbers dont match anymore Change-Id: I848e2e19fefab60c7e41a9561bf9ee773bf56af8 --- lib/mc_bin_client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/mc_bin_client.py b/lib/mc_bin_client.py index 7677a405e5..e7b499707c 100644 --- a/lib/mc_bin_client.py +++ b/lib/mc_bin_client.py @@ -133,6 +133,12 @@ def set(self, key, exp, flags, val): """Set a value in the memcached server.""" return self._mutate(memcacheConstants.CMD_SET, key, exp, flags, 0, val) + def send_set(self, key, exp, flags, val): + """Set a value in the memcached server without handling the response""" + self.vbucketId = crc32.crc32_hash(key) & 1023 + opaque = self.r.randint(0, 2 ** 32) + self._sendCmd(memcacheConstants.CMD_SET, key, val, opaque, struct.pack(SET_PKT_FMT, flags, exp), 0) + def add(self, key, exp, flags, val): """Add a value in the memcached server iff it doesn't already exist.""" return self._mutate(memcacheConstants.CMD_ADD, key, exp, flags, 0, val)