<!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.2769" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>You access memcached via keys. Each key has a id and value. If 
you were to select a row from a database you would put the result of the query 
into memcached via a key. Here is an example of how that would work in 
perl:(from danga's site)</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV>sub get_foo_object {<BR>&nbsp;&nbsp; my $foo_id = 
int(shift);<BR>&nbsp;&nbsp; my $obj = 
$::MemCache-&gt;get("foo:$foo_id");<BR>&nbsp;&nbsp; return $obj if 
$obj;<BR><BR>&nbsp;&nbsp; $obj = $::db-&gt;selectrow_hashref("SELECT .... FROM 
foo f, bar b 
".<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"WHERE ... AND f.fooid=$foo_id");<BR>&nbsp;&nbsp; 
$::MemCache-&gt;set("foo:$foo_id", $obj);<BR>&nbsp;&nbsp; return 
$obj;<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=jerome.m@gmail.com href="mailto:jerome.m@gmail.com">Jerome 
  Macaranas</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=adam@digitalagemedia.net 
  href="mailto:adam@digitalagemedia.net">Adam Michaels</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=memcached@lists.danga.com 
  href="mailto:memcached@lists.danga.com">memcached@lists.danga.com</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, December 14, 2005 1:02 
  AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: Newbie inquiry</DIV>
  <DIV><BR></DIV>does is it destroy all or destroy part of the cache w/c was 
  updated?<BR><BR>if it destroys all the cache content would it make any 
  difference on the mysql cache... since the cache rebuilds it self everytime 
  there is an manipulation on the data?<BR><BR>im not trying to create hassle im 
  just clearing some things.. : )<BR><BR><BR><BR>ill put Lighttpd into 
  consideration...<BR><BR>tia,<BR><BR>
  <DIV><SPAN class=gmail_quote>On 12/14/05, <B class=gmail_sendername>Adam 
  Michaels</B> &lt;<A 
  href="mailto:adam@digitalagemedia.net">adam@digitalagemedia.net</A>&gt; 
  wrote:</SPAN>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
    <DIV><FONT size=2>1. You need to destroy the cache via a delete and then 
    rebuild it with the new data. Your application is responsible for keeping 
    the cache up to date.</FONT></DIV>
    <DIV><FONT size=2></FONT>&nbsp;</DIV>
    <DIV><FONT size=2>2. Drop apache and use Lighttpd. It will use less memory 
    and therefore leave you with more memory to use with memcached.</FONT></DIV>
    <DIV><SPAN class=e id=q_10828709a4dfa572_1>
    <DIV><FONT size=2></FONT>&nbsp;</DIV>
    <BLOCKQUOTE 
    style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">----- 
      Original Message ----- </DIV>
      <DIV 
      style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial"><B>From:</B> 
      <A title=jerome.m@gmail.com 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:jerome.m@gmail.com" target=_blank>Jerome Macaranas</A> </DIV>
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B> 
      <A title=memcached@lists.danga.com 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:memcached@lists.danga.com" 
      target=_blank>memcached@lists.danga.com</A> </DIV>
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B> 
      Wednesday, December 14, 2005 12:40 AM</DIV>
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B> 
      Newbie inquiry</DIV>
      <DIV><BR></DIV>Hi ALL,<BR><BR>&nbsp;&nbsp; Im trying to get enough details 
      on memcached to check whether it is feasible to use it on a site that is 
      very dynamic.<BR>&nbsp;&nbsp; Can anyone clear my clouded mind. 
      :)<BR>&nbsp;&nbsp; 1.&nbsp; If data are cached and in the event that the 
      page was updated what happens to the cache? will it be completely 
      reconstructed? or only portion of it will be replaced?<BR>&nbsp;&nbsp; 
      2.&nbsp; Would you recommend memcache to sit on the same box with apache 
      with a 4G RAM 
  resource?<BR><BR>thanks,<BR></BLOCKQUOTE></SPAN></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>