def findDiputadoById(self, uuid): key = "dip_%s" % (uuid) e = memcache.get(key) if e is None: q = Diputado.gql("WHERE uuid = :1", uuid) e = q.get() if not memcache.add(key, e): logging.error("Memcache set failed.") else: logging.info("using cache") return e
def findDiputadoById( self, uuid ): key = "dip_%s" % (uuid) e = memcache.get( key ) if e is None: q = Diputado.gql("WHERE uuid = :1",uuid ) e = q.get() if not memcache.add( key, e ): logging.error("Memcache set failed.") else: logging.info("using cache") return e
def getDownDiputadosIniciativas(self, limit, tipo): key = "down_%s_%d" % (tipo, limit) results = memcache.get(key) if results is None: q = Diputado.all() q.order(tipo) results = q.fetch(limit) if not memcache.add(key, results): logging.error("Memcache set failed.") else: logging.info("using cache in getdown") return results
def getDownDiputadosIniciativas(self, limit, tipo): key = "down_%s_%d" % (tipo, limit) results = memcache.get( key ) if results is None: q = Diputado.all() q.order(tipo) results = q.fetch( limit ) if not memcache.add( key, results ): logging.error("Memcache set failed.") else: logging.info("using cache in getdown") return results