Afficher un message
Vieux 10/08/2007, 14h30   #2
ZeldorBlat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: detecting a function call

On Aug 10, 6:52 am, "philm" <gate...@microsoft.com> wrote:
> Asking for direction if possible.
>
> What I would like to be able to do is detect when particular functions are
> called, so as to be able to set up a results cache, and use that instead of
> continual db calls and processing.
>
> Other alternative I suppose, is to look at building in caching in each
> function...
>
> .. in hope
> PhilM


The second way is the way to do it. For instance:

funciton getFoo() {
//try to get foo from the cache
$foo = Cache::fetch('foo');

if($foo == false) {
$foo = ... //code to get foo from the database.
Cache::write('foo', $foo); //put foo in the cache
}

return $foo;
}

  Réponse avec citation
 
Page generated in 0,05036 seconds with 9 queries