Google App Engine memcache keys

This only works on the development web server, but it enables you to see what the keys of the memcache are. Paste it into the Interactive Console (part of the Development Console) for instant gratification.

from google.appengine.api.apiproxy_stub_map import apiproxy
print apiproxy.GetStub('memcache')._the_cache.keys()

(before anyone asks, this only works on the development server, you can’t do this on a live site because of the implementation differences)
update: seem that in the new sdk the cache is organised differently, so you need to add [''] like this:

from google.appengine.api.apiproxy_stub_map import apiproxy
print apiproxy.GetStub('memcache')._the_cache[''].keys()

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>