4

I want to use all the data in my python app engine memcache. I do not know the keys in advance.

How do I go about getting all data?

blippy
  • 9,438
  • 13
  • 48
  • 70
  • There does not seem to be a way to list all known keys. Why would you want to do that? – mahmoud Aug 31 '10 at 18:03
  • static data loaded via cron once a day. Thinking about it, I could just pack it all into a list and give it a known key... – blippy Aug 31 '10 at 18:08
  • 1
    The data in memcached isn't guaranteed to stick around. You are better off using a processor prior to the request handler to load/store the info (assuming you are using a toolkit that supports it) – Matt Mar 02 '11 at 18:56
  • I posted an alternative way to list the keys via telnet over on a [similar question](http://stackoverflow.com/questions/3611830/how-do-i-return-all-memcached-values-in-google-app-engine): http://stackoverflow.com/questions/3611830/how-do-i-return-all-memcached-values-in-google-app-engine – rootsmith Mar 02 '11 at 18:45

3 Answers3

4

The only read functions available on memcache are:

get(key, namespace=None)

get_multi(keys, key_prefix='', namespace=None)

As you can see, to get data from memcache you must provide one or more keys.

systempuntoout
  • 69,075
  • 45
  • 164
  • 239
1

I am using a 'well known key' called "config" where I store a list of all other keys and use that to enumerate the rest of the items.

vivekv
  • 2,139
  • 2
  • 22
  • 36
0

as in comments above, I guess I could stick all data in a single memcache entry with a known key.

Still for non-static data there are scenarios where it would be useful.

blippy
  • 9,438
  • 13
  • 48
  • 70