<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY
style="WORD-WRAP: break-word; webkit-nbsp-mode: space; webkit-line-break: after-white-space">
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2>It would be nice to be able to add multiple tags with a
single commands : add_tag(key, tag1, tag2, ..., tagN), to avoid multiple
roudtrips, or add a tag list as an optionnal parameter to the
set/add/replace commands. ie : set <key> <flags>
<exptime>
<bytes> <tag1>,<tag2>,<tag3>...\r\n</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2>AFAIAC, I think tags need to be released. My use for tags
would be to tag cache entries by content id/user id/channel id. Having to store
every id used (even deleted content/content not accessed for a long time)
since the last start of memcached would be a problem...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2>I did not have enough spare cycles to think about the
invalidation process...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2>Jean-François</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=863311107-04102007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=fr dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>De :</B> memcached-bounces@lists.danga.com
[mailto:memcached-bounces@lists.danga.com] <B>De la part de</B> Dustin
Sallings<BR><B>Envoyé :</B> jeudi 4 octobre 2007 01:17<BR><B>À :</B>
Memcached list<BR><B>Objet :</B> tag proposal<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><BR class=webkit-block-placeholder></DIV><SPAN class=Apple-tab-span
style="WHITE-SPACE: pre"></SPAN>Tags seem to be getting hot and lots of people
have talked about it fairly abstractly. I wanted to try to bring some of
those together with respect to a memcached implementation and sit back and
watch it all happen. :)
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>Firstly, I
think there are two new commands to implement tags:</DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>1)
add_tag (key, tag_name)<BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>2)
invalidate_tag (tag_name)<BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>I don't think
there's a need for tag inspection for a given object. There is
*definitely* no command to search by tag.</DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>All of the
actual tags (text) would exist in a global hash table whose value is a
generation number.<BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>[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?]<BR
class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>A single
global generation number is used to track invalidation events.<BR
class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>Each cache
item contains a space for pointers to tags with their individual generation
numbers and a local generation number.</DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>When a tag is
added to an item, the global generation number is copied into the item's local
generation number (if it's not set), and the tag space is extended to point to
the tag key at its current individual generation.<BR
class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>Adding an
existing tag to an item must not cause any modification to the item (i.e.
check first).<BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>Invalidation
of a tag would basically be a ``global_generation = ++tags[tag]'' kind of
operation.<BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>Each time an
item is requested from a cache, the local generation number is compared
against the global generation number. If it differs, each tag is checked
to ensure the tag generation number equals the number stored for that
tag.</DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>If they're all
the same, the local generation number is set to the global generation
number.<BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>If they're
different, this record doesn't exist.<BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><BR class=webkit-block-placeholder></DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>I've secretly
left a lot of holes in this concept as a puzzle to the reader. Three
units of cool to each person who finds one.<BR
class=webkit-block-placeholder></DIV>
<DIV><BR>
<DIV><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2">
<DIV>-- </DIV>
<DIV>Dustin Sallings</DIV><BR
class=Apple-interchange-newline></SPAN></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>