def __call__(self, *key): mk = self.mc_key % '_'.join(map(str, key)) num = mc.get(mk) if num is None: #print "self.get_num", key, self.get_num(*key) num = self.get_num(*key) or 0 mc.set(mk, num, self.timeout) return num
def decr(self, *key): mk = self.mc_key % '_'.join(map(str, key)) if mc.get(mk) is not None: mc.decr(mk)
def get(self, *args): key = self.key_pattern%args result = mc.get(key) if result is not None: return array(self.type, result)
def get(self, *args): key = self.key_pattern%args return mc.get(key)