You are here: Re: detecting a function call « PHP Language « IT news, forums, messages
Re: detecting a function call

Posted by ZeldorBlat on 08/10/07 13:30

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;
}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация