tag proposal

Brian Beuning BBeuning at corecard.com
Fri Nov 2 23:17:39 UTC 2007

I have been reading the archive.
Here is a post about tags from Oct 3.

> Firstly, I think there are two new commands to implement tags:
> 1) add_tag (key, tag_name)
> 2) invalidate_tag (tag_name)
It took me a little while to figure out that add_tag() does not need to talk
with all nodes
of the cache but it seems like invalidate_tag() does need to talk to all
What is going to happen if one or more nodes are behind a network partition
type failure?
(The Ethernet cable on a server is unplugged but memcached is still
They could not be notified to increment their tag generation number so when
the partition
is fixed and the machines become accessible, those nodes have stale data.

> [It's unclear whether it's worth the effort to ever release a tag once
it's been added.
>  If we assume that tags live forever, we don't have to refcount them and a
few things get easier. Any opinions?] 

I think the list agreed releasing tags is good.

A unified way to handle this is to let a tag age out of the cache using the
LRU and timeout
mechanisms already in place.  The only twist is that accessing a key is also
accessing all the tags associated with that key for LRU purposes.  Given
this rule, a tag
should never get flushed until after all the keys using the tag are flushed.
(When a tag has
just one key left using the tag and the key has not been accessed, there is
sort of a race as
to which will age out first.  This is a tricky case to get right.)

Are the key and tag names one or two namespaces?  That is can you have a tag
and key with the same name?
I suggest making it one namespace for simplicity.

Brian Beuning

More information about the memcached mailing list