I've tested simple CAS setup, two parallel python processes updating some key on single shared server:
- Set the key:
- Run two processes with that code:
for x in range(10**5):
while True:
k = mc.gets('k')
if mc.cas('k', k+1):
break
- Read the key:
mc.get('k')
# some random number less than 2*10^5 (usually about 1.5*10^5)
The cas() call never failed.
Same test, but with cas() replaced by incr() always gives 2*10^5
Python 3.6.3, python-memcached==1.59, everything was inside docker-compose setup