OJFord
OJFord

Reputation: 11130

Is it possible to get all keys with prefix from GAE memcache?

I would like to do something like:

memcache.get_multi(ALL, key_prefix='somePrefix_')

in order to read every memcached key with the prefix somePrefix_.

This question asks whether all keys can be found, and this answer to another question offers an undocumented debugging-only method in PHP. However I don't want to cachedump and then find my prefix, it seems kind of hacky - and at any rate I am looking for this to stay in after development.

I tried an empty list of keys, [], thinking that in the spirit of 0 being often used for 'unlimited' it might find them all. Alas, it did not.

I suspect this means it is not possible (as there is no other function to use, and I can't think how else 'all' might be represented) - but I would just like to confirm this as it makes the key_prefix option seem only vaguely useful, in my opinion. (When I saw it in docs, my first thought was "ah neat, I can grab everything with some prefix at once!")

Upvotes: 3

Views: 1790

Answers (1)

marcadian
marcadian

Reputation: 2618

Nope, you can only get the item if you know the key.

Upvotes: 4

Related Questions