Skip to content

Commit

Permalink
added an async_set command
Browse files Browse the repository at this point in the history
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
  • Loading branch information
farshidce committed Jun 5, 2011
1 parent 96df85a commit c0d2a86
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mc_bin_client.py
Expand Up @@ -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)
Expand Down

0 comments on commit c0d2a86

Please sign in to comment.