FW: Can I create multi hash table?
NTPT
NTPT at seznam.cz
Mon Oct 2 08:58:09 UTC 2006
Adding perfix or suffix to your keys and not flush but wait for LRU to remove invalid keys is a brillant idea , it allow simulate 2 (may be n ) dimensional caches, but you need to store perfixes for identifiers (i do not know if I say it so clear ) and a bit of additional logic...
> ------------ Původní zpráva ------------
> Od: 邵明岐 <shaomq at gmail.com>
> Předmět: FW: Can I create multi hash table?
> Datum: 28.9.2006 07:45:00
> ----------------------------------------
>
>
>
> 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.
>
>
>
>
>
>
>
>
>
More information about the memcached
mailing list