发布时间:2019-08-09 08:50:59编辑:auto阅读(2411)
from pymemcache.client.base import Client
client = Client(('localhost', 11211))
client.set('some_key', 'some_value')
result = client.get('some_key')
from pymemcache.client.hash import HashClient
client = HashClient([('127.0.0.1', 11211),('127.0.0.1', 11212)])
client.set('some_key', 'some value')
result = client.get('some_key')
import json
from pymemcache.client.base import Client
def json_serializer(key, value):if type(value)== str:return value, 1
return json.dumps(value), 2
def json_deserializer(key, value, flags):if flags == 1:return value
if flags == 2:return json.loads(value)raiseException("Unknown serialization format")
client = Client(('localhost', 11211), serializer=json_serializer,
deserializer=json_deserializer)
client.set('key',{'a':'b', 'c':'d'})
result = client.get('key')
上一篇: rails3的render(:updat
下一篇: ubuntu 的3D效果
48876
47943
38724
35865
30292
27048
26075
20911
20717
19076
515°
613°
618°
620°
597°
581°
650°
718°
839°
948°