'''memcached内存数据库''''''redis集群redis-py-cluster模块'''#from rediscluster import StrictRedisCluster'''memcachedpip install python-memcachedmemcached -d -m 10 -u root -l 127.0.0.1 -p 12000 -c 256 -P'''import memcachemc = memcache.Client(['192.168.4.10:12000'])print(mc)mc.set("aaa","hello world")print(mc.get("aaa"))'''ps -ef | grep memcachedmemcached -d -m 10 -u root -l 192.168.4.10 -p 12000 -c 256 -P /export/servers/memcache/logs/memcache.pidps -ef | grep memcached''''''set、add/replace/append/prepand/casset(key,value)get(key)mc.add("mctestadd","nihao")print(mc.get("mctestadd"))replace(key,new_value)修改某个key的值,不存在报错set和add的区别set = add + replaceset_multi({"k1":"v1","k2":"v2","k3":"v3"}) # 一次多个值删除delete(key)delete_multi([k1,k2,k3])获取get(key)get_multi([k1,k2,k3])mc.append("aaa","321") #key的后面追加print(mc.get("aaa"))mc.prepend("aaa","556") #key的前面追加print(mc.get("aaa"))print(mc.stats) ''''''statsgetscas'''