News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Content with Style Blog:
A caching pattern for models
April 17, 2009 @ 08:44:38

On the Content with Style blog there's a new post by Pascal Opitz talking about a suggested caching pattern for use with the Zend_Cache component of the Zend Framework and the __call magic method.

The initial thought behind this is that a model should be able to return calls either uncached or cached, without initializing some cache object every time. It should be easy to switch between the two calls, and the cache should be coming with the model object already.

He compares the old way - making a new cache object and performing actions based on that - to his new way of already having a cache object as a part of the model to help with storing any information you wanted anywhere inside. He includes a code example showing the method, basically a call to create the cached object in the constructor and, when a method is called, the __call traps it and dynamically attaches that cache object to it.

1 comment voice your opinion now!
caching pattern model zendcache zendframework model tutorial


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Dynamically Creating Compressed Zip Archives With PHP

Chris Renner's Blog: Gerrymandered Code: Extending Zend_Registry to globalize session vars

Slawek Lukasiewicz's Blog: Zend Framework: logging with Firebug and FirePHP

Joey Rivera's Blog: Caching using PHP/Zend_Cache and MySQL

Community News: PHPFreaks Relaunch


Community Events

Don't see your event here?
Let us know!


podcast laravel community language interview php7 api voicesoftheelephpant series opinion laravel5 framework unittest video library example release introduction security version

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework