def get(self): result = memcache.get("words") if not result: result = simplejson.dumps( {"words": [ w.name for w in Word.all().fetch(1000) ]}, ensure_ascii=False) memcache.set("words", result) self.response.content_type = "application/json" self.response.out.write(result) return
def get(self): result = memcache.get("index") if not result: logging.info("cache not hit(index)") template_values = { 'words': Word.all().fetch(1000) } path = os.path.join(os.path.dirname(__file__), '..', 'view', 'index.html') result = template.render(path, template_values) memcache.set("index", result, 600) self.response.out.write(result)