[pLog-svn] r3206 - plog/trunk/class/cache

Oscar Renalias oscar at renalias.net
Sat Apr 8 00:03:19 GMT 2006


This is the fix I mentioned, looks like it wasn't that difficult after all :)

Apparently the cache for articles (the Articles class is the only
place where setMultipleData was being called) was growing without
limit for single articles... No wonder my data cache was over 100mb
before I cleaned it up!! I had some articles copied over 500 times in
the same cache file.

I am already testing this fix in my blog and lifetype.net. When you
apply it, please keep an eye on the performance (or at file
tmp/metrics.log, which keeps a history of requests and execution
times)

Oscar

On 4/8/06, oscar at devel.lifetype.net <oscar at devel.lifetype.net> wrote:
> Author: oscar
> Date: 2006-04-07 23:28:35 +0000 (Fri, 07 Apr 2006)
> New Revision: 3206
>
> Modified:
>    plog/trunk/class/cache/cache.class.php
> Log:
> fixed an issue regarding the cache, where the cache kept growing and growing every time Cache::setMultipleData was being called.
>
>
> Modified: plog/trunk/class/cache/cache.class.php
> ===================================================================
> --- plog/trunk/class/cache/cache.class.php      2006-04-07 19:57:20 UTC (rev 3205)
> +++ plog/trunk/class/cache/cache.class.php      2006-04-07 23:28:35 UTC (rev 3206)
> @@ -46,7 +46,16 @@
>
>                                 $currentData = $this->getData( $id, $group );
>                                 if( !$currentData ) $currentData = Array();
> -                               $currentData[] = $data;
> +
> +                               /**
> +                                * :TODO:
> +                                * It's clear that we're only going to cache DbObjects using this method
> +                                * but what happens if we don't? Should we force developers to provide a method
> +                                * to uniquely identify their own objects? We definitely need a unique id here so that
> +                                * the array doesn't grow forever...
> +                                */
> +                               $currentData[$data->getId()] = $data;
> +
>                  return $this->cache->save( $currentData, $id, "$group" );
>              } else
>                  return true;
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>


More information about the pLog-svn mailing list