News Feed
Sections




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

Procurios Blog:
Fragment Cache - an introduction / PHP
June 11, 2010 @ 08:39:21

On the Procurios blog today there's a new post talking about a different sort of way to optimize your site's perfomance - fragment caching.

So if web caching is not an option, what is the next best thing? To cache parts of the page, put them together, and serve that. You can use a caching tool for this, like Memcached. There's only one catch: the cached content may need to change when any of the things it depends on changes: data, code, user input, and the like. You can pass an expiration time when you add your content to Memcache. This will cause your cache to live only a certain amount of time and then expire. Nice, but we can do better.

The method he talks about involves expiring the cached data when the dynamic data it comes from has expired rather than setting an expiration time on the data itself. Each time the data its pulled/rendered, the cached data is checked and is updated if the need is there. You're not so much checking for a valid cache as you are forcing an update when needed. There are some side effects mentioned like more database load and increased server load because of the data generation each time.

Code examples are included in the post that use this caching library to get the job done. You can also see how it works in the test file using that library.

0 comments voice your opinion now!
fragment cache tutorial expire content


blog comments powered by Disqus

Similar Posts

Derick Rethans' Blog: Xdebug and tracing memory usage

Michelangelo van Dam's Blog: Quality Assurance on PHP projects - PHP_CodeSniffer

Zend Developer Zone: Scalability and Responsiveness with Zend Platform's Job Queue

Ask About PHP Blog: Google Analytics API class for PHP

Juozas Kaziukenas' Blog: Zend Framework and Microsoft IIS


Community Events





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


composer tool language interview mvc security podcast library laravel version introduction series framework opinion symfony package community voicesoftheelephpant release update

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