Commits

lenmore committed f04ccfe

缓存列表

  • Participants
  • Parent commits ebbf2f3

Comments (0)

Files changed (1)

 
 import webapp2
 from google.appengine.api import urlfetch
-from google.appengine.ext.webapp import util
+from google.appengine.api import memcache
 
 import config
 import cache
         else:
             self.error(res.status_code)
 
-        
+
+class CachedPageListHandler(webapp2.RequestHandler):
+    def get(self):
+        self.response.write('<a href="/mcf">Flush Memcached</a> <br><br>')
+        pck = memcache.get('__PCK')
+        if pck:
+            for k in pck:
+                self.response.write('<a href="%s" target="_blank">%s</a> <br>' % (k.replace('PGC_', ''), k.replace('PGC_', ''), ))
+
+class CacheFlushHandler(webapp2.RequestHandler):
+    def get(self):
+        cache.flush_all()
+        self.redirect("/mc")
+
 
 app = webapp2.WSGIApplication([ ('/static/.*', StaticHandler)
+                                , ('/mc', CachedPageListHandler)
+                                , ('/mcf', CacheFlushHandler)
                                 , ('/.*', AnyHandler) ]
                               , debug=config.DEBUG)