Exemple #1
0
 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
Exemple #2
0
 def decr(self, *key):
     mk = self.mc_key % '_'.join(map(str, key))
     if mc.get(mk) is not None:
         mc.decr(mk)
Exemple #3
0
 def get(self, *args):
     key = self.key_pattern%args
     result = mc.get(key)
     if result is not None:
         return array(self.type, result)
Exemple #4
0
 def get(self, *args):
     key = self.key_pattern%args
     return mc.get(key)