Home arrow PHP arrow Caching Result Sets in PHP: Object Interaction Within a Caching System

Caching Result Sets in PHP: Object Interaction Within a Caching System

In this article, we work directly with a standalone caching class, showing how it interacts with other objects. We will work with aggregation and composition to achieve our goals, which include implementing a time expiry based caching mechanism.

TABLE OF CONTENTS:
  1. Caching Result Sets in PHP: Object Interaction Within a Caching System
  2. The first link in the caching process: looking at the “Cache” class
  3. The second link in the caching process: overview of the “MySQL” class
  4. The third link in the caching process: a quick look at the “Result” class
  5. Chaining the links: putting the classes together
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
October 17, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Here you have it. This is the fourth part of the series “Caching result sets in PHP.” Through the previous article, we went a long way, by developing an extensible result set caching class, which is aimed specifically at reducing one of the most common workloads often associated with database-driven websites: repetitive query execution.

We arranged that, after performing regular SELECT statements, the obtained result set is stored in a simple cache file for faster retrieval. While the logic involved in caching result sets has been utilized for quite a long time, the different approximations for tackling this issue are certainly numerous.

However, when we’re working on large projects, an object-oriented solution probably is best for managing all of the problems that arise, due mainly to the huge size of applications. And definitely, a caching system is yet another piece within the development environment that can be easily addressed through the object-oriented paradigm.

According to this concept, I’ve hopefully demonstrated that a caching class may be created without the need to get too deep into complex programming definitions. Although following the practical approach may lead quickly to developing simple applications, I firmly recommend being armed with the proper theory and then using it to deploy well-structured projects.

It seems that we’re not very close to working directly with a caching class. Well, I don’t think so. If we step back to the previous article, certainly we’ve developed such a class. However, it’s rather conceived as a programming object that interacts with at least two additional objects, and not as a standalone class.

Therefore, we need to complete the scenario, not only showing how the class may be correctly implemented, but how the additional classes interact with each other.

Are you feeling inclined to work with aggregation and composition? All right, let’s get started.



 
 
>>> 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: