How to flush memcache from appcfg.py?

621 Views Asked by At

How can I flush (delete all entries of) memcache using appcfg.py?

Normally during code update, I want to flush the memcache to prevent incompability between the old and new code. Can it be done on the command line, instead of going to the developer console and manually click the "Flush Cache" button?

1

There are 1 best solutions below

1
On BEST ANSWER

Sorry, no, the command-line tools have no feature to flush the memcache of a running app.

You could instrument your own command-line memcache flush via the memcache API's flush method (e.g. flush_all() in Python). You could build this in one of two ways: 1) Use Cloud Endpoints and Google API Client to make your own authenticated endpoint and command-line client to call it, and have the endpoint call the method. Or, 2) use the built-in remote API proxy and corresponding client library to call the memcache API.

https://developers.google.com/appengine/docs/python/memcache/functions#Client_flush_all

https://developers.google.com/appengine/docs/python/tools/remoteapi https://developers.google.com/appengine/docs/java/tools/remoteapi

https://developers.google.com/appengine/docs/java/endpoints/ https://developers.google.com/discovery/libraries

It's not as crazy as it sounds, if it's important. :)