FW: Can I create multi hash table?

=?gb2312?B?ydvD9+Gq?= shaomq at gmail.com
Thu Sep 28 05:44:24 UTC 2006


 
 

Mingqi, Shao

 

  _____  

·¢¼þÈË: memcached-bounces at lists.danga.com
[mailto:memcached-bounces at lists.danga.com] ´ú±í Mingqi Shao
·¢ËÍʱ¼ä: 2006Äê9ÔÂ27ÈÕ 12:40
ÊÕ¼þÈË: Steven Grimm
³­ËÍ: memcached at lists.danga.com
Ö÷Ìâ: Re: Can I create multi hash table?


Steven, thank you for the answer. I think I have comprehended.
I hava another question. I don't find more detail document about memcached,
so I want to know what is the difference of set and replace command? 
Can you  share some document of memcache with me? thanks. 



ÔÚ06-9-27£¬Steven Grimm <sgrimm at facebook.com> дµÀ£º 

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.

-Steve


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 facebook.com>: 

¿ÉÒÔ¡£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...
URL: http://lists.danga.com/pipermail/memcached/attachments/20060928/b3ebfd14/attachment.htm


More information about the memcached mailing list