Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
	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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
	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