How to use locks for assuring atomic operation in Memcached?