Esempio n. 1
0
class MC(object): 
    def __init__(self, mc_addrs, pool_size=16, binary=False): 
        mc = Client(mc_addrs, binary=binary) 
        self.mc_pool = ClientPool(mc, pool_size) 
    def get(self, key): 
        with self.mc_pool.reserve() as mc: 
            return mc.get(key) 
    def get_multi(self, keys): 
        with self.mc_pool.reserve() as mc: 
            return mc.get_multi(keys) 
    def set(self, key, data, rev=0): 
        with self.mc_pool.reserve() as mc: 
            return bool(mc.set(key, data, rev)) 
    def delete(self, key): 
        with self.mc_pool.reserve() as mc: 
            return bool(mc.delete(key)) 
Esempio n. 2
0
 def __init__(self, mc_addrs, pool_size=16, binary=False): 
     mc = Client(mc_addrs, binary=binary) 
     self.mc_pool = ClientPool(mc, pool_size)