Newbie inquiry

Adam Michaels adam at digitalagemedia.net
Wed Dec 14 09:06:03 UTC 2005


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)

sub get_foo_object {
   my $foo_id = int(shift);
   my $obj = $::MemCache->get("foo:$foo_id");
   return $obj if $obj;

   $obj = $::db->selectrow_hashref("SELECT .... FROM foo f, bar b ".
                                   "WHERE ... AND f.fooid=$foo_id");
   $::MemCache->set("foo:$foo_id", $obj);
   return $obj;
}


  ----- Original Message ----- 
  From: Jerome Macaranas 
  To: Adam Michaels 
  Cc: memcached at lists.danga.com 
  Sent: Wednesday, December 14, 2005 1:02 AM
  Subject: Re: Newbie inquiry


  does is it destroy all or destroy part of the cache w/c was updated?

  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?

  im not trying to create hassle im just clearing some things.. : )



  ill put Lighttpd into consideration...

  tia,


  On 12/14/05, Adam Michaels <adam at digitalagemedia.net> wrote:
    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.

    2. Drop apache and use Lighttpd. It will use less memory and therefore leave you with more memory to use with memcached.

      ----- Original Message ----- 
      From: Jerome Macaranas 
      To: memcached at lists.danga.com 
      Sent: Wednesday, December 14, 2005 12:40 AM
      Subject: Newbie inquiry


      Hi ALL,

         Im trying to get enough details on memcached to check whether it is feasible to use it on a site that is very dynamic.
         Can anyone clear my clouded mind. :)
         1.  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?
         2.  Would you recommend memcache to sit on the same box with apache with a 4G RAM resource?

      thanks,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20051214/520a73d3/attachment.htm


More information about the memcached mailing list