Listing Keys in Cache ??

Clint Webb webb.clint at gmail.com
Fri Sep 7 07:55:41 UTC 2007


Almost everyone who uses memcache for the first time, asks that question, me
included.  However after using memcache for some time now I have the opinion
that NOT having access to the list of key names is probably one of the
better features of memcached.

By saying this, I mean that the reason people WANT the list of keys is
because they are wanting to use memcached in a way that its not really
optimal for.  It is not a system for storage.  It is not an SQL query
cache.  It is an object cache.  And should be used as an object cache.

Normally people ask this question because they want to be able to retrieve a
list of keys so that they can determine which ones need to be removed.  If
you need to do this with your system design, then you have designed it
wrong.

Now, admittedly, there are always fringe cases where a careful and
meticulous system design could benefit from being able to retrieve the list
of keys.   But I would be surprised if anyone can come up with more than a
couple of specific instances.

If you want the list of keys for debugging purposes, you can always start up
the memcached server in verbose mode and that way you will know what is
happening in far more detail.

In conclusion, I'm firmly against adding that feature, because it will
encourage people to use memcached in ways that its really not designed for,
and then complaining that it doesn't work as well as other solutions (which
are designed for it).   memcached is simple, and it should be kept that
way.  Thats what is so great about it.

PS: I do like the idea of tags, but not as a work-around for the limitations
of obtaining a list of keys.

On 9/7/07, Ajinkya Nahar <ajinkya at truesparrow.com> wrote:
>
> Hi,
>
> According to me, I don't think we have such feature yet.
> However, this will be really helpful.
>
> Regards,
> Ajinkya
>
>
> -----Original Message-----
> From: memcached-bounces at lists.danga.com
> [mailto:memcached-bounces at lists.danga.com] On Behalf Of Fil Matthews
> Sent: Friday, September 07, 2007 12:11 PM
> To: memcached at lists.danga.com
> Subject: Listing Keys in Cache ??
>
> Gentleman
>
> I have just subscribed to the official mailing list.  But I thought I
> would throw this question into the pool.
>
> Forgive my ignorance as I am new to memcached  but is there anyway to
> simply ask the cache for a KEY listing of all keys cached???
>
> Values aren't necessary  just the Keys???
>
> Many thanks in advance
>
>
> Fil
>
>
>


-- 
"Be excellent to each other"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070907/d9af0fc1/attachment-0001.htm


More information about the memcached mailing list