How to get all the keys from servers?

Jed Reynolds lists at benrey.is-a-geek.net
Mon Dec 4 20:53:00 UTC 2006


Jamie McCarthy wrote:
> renatosilveira at gmail.com (Renato Silveira) writes:
>
>   
>> I have to implement a routine that returns all the keys/values
>> from memcached.
>>     
>
> The short answer is, no, you probably don't.  To avoid a rehash of
> this discussion please see:
>
> http://lists.danga.com/pipermail/memcached/2006-July/thread.html#2536
>
> If you really do need this, I have a patch to 1.1.12 that implements
> a "list" command, to return all keys on a server.  However it's
> really hacked together, probably does memory allocation the wrong
> way, and may cause infinite loops due to a bug I never bothered to
> track down.  Plus I never really learned anything interesting from
> experimenting with it.  Its use is not recommended.
>
> But if you've read the above and really still want it, email me.
>   
I'd have a use for a method to get all keys as well. For instance, if I
wanted to store all the IPs that hit my webserver, and how many times,
memcached would work perfectly, especially because of the incr
capability. The statistics don't have to be highly accurate, so some
lost updates would be acceptable, and I don't have to read the data
before writing it. But in order to find the highest requester, I'd have
to sort all keys by value...need to be able to stream out all the keys
and values.


Jed


More information about the memcached mailing list