libmc 是一个高效轻便的 C++/Python Memcached 客户端库,可用来替代 libmemcached 和 python- libmemcached.
示例代码:
import libmc from libmc import ( MC_HASH_MD5, MC_POLL_TIMEOUT, MC_CONNECT_TIMEOUT, MC_RETRY_TIMEOUT ) mc = libmc.Client( ['localhost:11211', 'localhost:11212'], do_split=True, comp_threshold=0, noreply=False, prefix=None, hash_fn=MC_HASH_MD5, failover=False ) mc.config(MC_POLL_TIMEOUT, 100) # 100 ms mc.config(MC_CONNECT_TIMEOUT, 300) # 300 ms mc.config(MC_RETRY_TIMEOUT, 5) # 5 s