发布时间:2019-08-09 08:50:59编辑:auto阅读(2099)
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效果
47496
45799
36797
34327
28970
25600
24445
19613
19113
17635
5469°
6051°
5573°
5640°
6575°
5378°
5380°
5887°
5858°
7174°