I'm trying to use the gets
and cas
methods from pylibmc(v1.5.2) to interact with the memcached server. As documented, we should pass the cas token from gets
to cas
.
token = mc.gets("key_python_1")
mc.cas("key_python_1", "value_python_1_new", token)
# Or
mc.cas("key_python_1", "value_python_1_new", mc.gets("key_python_1"))
However, I got a ValueError: gets without cas behavior
err which is hard to understand.
Could someone shed some light on this issue? Any working example will be appreciated. Thanks ;)
--- Update ---
This is how I get mc
.
import pylibmc
mc = pylibmc.Client(["127.0.0.1"], binary=True, behaviors={"tcp_nodelay": True, "ketama": True})