예제 #1
0
파일: queue.py 프로젝트: mhawthorne/antonym
 def max_index(self):
     ckey = self.__max_index_key()
     v = memcache.get(ckey)
     if not v:
         v = 0
         memcache.set(ckey, v, **self.__defaults())
     return v
예제 #2
0
 def max_index(self):
     ckey = self.__max_index_key()
     v = memcache.get(ckey)
     if not v:
         v = 0
         memcache.set(ckey, v, **self.__defaults())
     return v
예제 #3
0
파일: queue.py 프로젝트: mhawthorne/antonym
 def remove(self):
     item_key = self.__item_key(self.max_index())
     value = memcache.get(item_key)
     if value:
         logging.debug("remove %s" % value)
         memcache.delete(item_key)
         memcache.decr(self.__max_index_key())
     return value
예제 #4
0
 def remove(self):
     item_key = self.__item_key(self.max_index())
     value = memcache.get(item_key)
     if value:
         logging.debug("remove %s" % value)
         memcache.delete(item_key)
         memcache.decr(self.__max_index_key())
     return value
예제 #5
0
 def args_wrapper(*args, **kw):
     key = key_call(*args, **kw)
     refresh = kw.pop("refresh", False)
     value = memcache.get(key)
     if refresh or not value:
         value = f(*args, **kw)
         if value:
             try:
                 memcache.set(key, value, **cache_kw)
             except Exception, e:
                 logging.error(traceback.print_exc())
예제 #6
0
 def args_wrapper(*args, **kw):
     key = key_call(*args, **kw)
     refresh = kw.pop("refresh", False)
     value = memcache.get(key)
     if refresh or not value:
         value = f(*args, **kw)
         if value:
             try:
                 memcache.set(key, value, **cache_kw)
             except Exception, e:
                 logging.error(traceback.print_exc())
예제 #7
0
 def args_wrapper(*args, **kw):
     value = memcache.get(key)
     if not value:
         value = f(*args, **kw)
         memcache.set(key, value, **cache_kw)
     return value
예제 #8
0
 def args_wrapper(*args, **kw):
     value = memcache.get(key)
     if not value:
         value = f(*args, **kw)
         memcache.set(key, value, **cache_kw)
     return value