Can you write to memcached only if key does not exist -


the use case generate unique key, want able this

while !memcache.write_if_not_exist(key, value, :expires_in => 1.minute)   key = generate_new_key end 

where write_if_not_exist not write value , return false if key exists in memcached.

answering own questions here, after researching memcached protocol. "add" command that.

https://github.com/memcached/memcached/blob/master/doc/protocol.txt


Comments