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
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
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
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
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())
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())
def args_wrapper(*args, **kw): value = memcache.get(key) if not value: value = f(*args, **kw) memcache.set(key, value, **cache_kw) return value
def args_wrapper(*args, **kw): value = memcache.get(key) if not value: value = f(*args, **kw) memcache.set(key, value, **cache_kw) return value