Home arrow PHP arrow Caching Result Sets in PHP: A Content-Change Triggered Caching System

Caching Result Sets in PHP: A Content-Change Triggered Caching System

Caching within the context of PHP application acceleration can be triggered based on three possible categories: time expiry, content change, and manually. This article covers an application that triggers the caching mechanism based on a content change condition.

TABLE OF CONTENTS:
  1. Caching Result Sets in PHP: A Content-Change Triggered Caching System
  2. Back to the origins: a quick overview of the time expiry based caching script
  3. Another caching strategy: building a content-change triggered caching system
  4. Wrapping the code: defining the “readData()” and “readQueryResult()” functions
  5. Gluing the pieces together: listing the whole source code
By: Alejandro Gervasio
Rating: starstarstarstarstar / 4
October 12, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Welcome to the second part of the series “Caching result sets in PHP.” Over the first part of the series, we discussed the benefits of having a result set caching system working on the backend, as an efficient mechanism to reduce the overhead caused to the server, particularly when it’s serving many requests from a database-driven application.

Indeed, the result set caching approximation presents some significant advantages over (X)HTML output caching, since it allows for performing some kind of post processing on the cached data, due to the inherent advantage of having the data completely isolated from the (X)HTML structure. This method differs significantly from the conventional “entire-output” caching, which offers a minor level of flexibility.

As with many issues within the context of PHP application acceleration, caching offers a wide range of implementations. Whatever caching system will be applied, its triggering mechanism is mostly based on three possible categories:

  • Time expiry based caching triggering
  • Content change based caching triggering
  • Manually based caching triggering

Of course, an application might use either one of these caching triggers, or a combination of them, because of the flexibility that result set caching brings to developers.

Stepping back to the first part of the series, we’ve looked at a caching script that falls under the first category, that is, triggered by a time expiry condition (usually specified in seconds), thereby forcing a new cache generation each time this condition is met.

Due mainly to the flexible nature of the generated source code, in this second part, we’ll take a look at an application that triggers the caching mechanism based on a content change condition, without modifying its core logic.

So, it looks like we need to write a bit more code. Let’s do it together. 



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: