I’m trying to find how to get all the keys from memcache
but I can not find the answer.
I saw some answer codes that using telnet but finally it didn’t work.
I want to know exactly how to get keys at once, using telnet or other things.
It should be done in python.
2
Answers
Having in mind that Memcache acts as dict there is:
As seen on:
https://pymemcache.readthedocs.io/en/latest/apidoc/pymemcache.client.base.html#pymemcache.client.base.Client.get_multi
There is answer how to do this using telnet protocol. As far as I know there are no commands in Python Library for doing the same:
How to export all keys and values from memcached with python-memcache?
A bit late, but here’s how I was able to do it.
client
is a pymemcached client,ensure_str
converts bytes to unicode (six.ensure_str
would work):Ends up with a format as follows:
Theory mostly taken from https://stackoverflow.com/a/19562199/4001895