Can I create multi hash table?

Steven Grimm sgrimm at
Wed Sep 27 03:53:23 UTC 2006

You have a couple options. If flushing all person data is a very
infrequent operation, you can do a "flush_all" command, which will flush
the entire cache, including all your product data. That's by far the
most efficient (on the memcached side, anyway) but obviously it means
your application will have to repopulate the whole cache, not just the
person data.

Alternately, if you need to flush all your person data often, you can
add another prefix or suffix to your keys: a version number. When you
want to flush the person data, just increase the version number you
append to all your person keys. The old values will still be in the
cache, but you will never look them up and they will eventually fall out
of the cache because of the LRU algorithm.

There is no way to perform bulk operations on a subset of the values in
the cache.

If you tell us a little more about why you want to flush your person
data, one of us can probably offer some alternate approaches. Assuming,
that is, that one of the two suggestions above isn't suitable for you.


Mingqi Shao wrote:
> In pre-example, if I want to remove all persion data from memcached,
> what shoule I to?
> I don't will run a separate memcached process for each object type.
> thanks.
> 2006/9/27, Steven Grimm < sgrimm at
> <mailto:sgrimm at>>:
>     ¿ÉÒÔ¡£You can get the same effect by just putting a prefix in
>     front of
>     the IDs. So instead of a key of "foo" for a product, you'd use
>     "product:foo". We do this very successfully with a large number of
>     different object types.
>     If you can't do that, then you can also run multiple memcached
>     instances
>     and fetch different object types from each instance. We actually do a
>     bit of that as well; we modified our client code to look at the
>     key and
>     choose from separate lists of servers for certain object types.
>     (Unfortunately due to some licensing ambiguities in the code we
>     modified, we can't release those changes.)
>     -Steve
>     ÉÛÃ÷᪠wrote:
>     > For example, I want to cache person and product information in
>     > memcached. Their key both are a identify of string type. Can I
>     create
>     > separate hash table for they in order to avoid a identify of a
>     person
>     > and a product are equivalent? thanks.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the memcached mailing list