Home arrow PHP arrow Developing a Caching Class for an MVC-based Framework in PHP 5

Developing a Caching Class for an MVC-based Framework in PHP 5

In this seventh part of the series, I add a cache class to the classes that comprise the MVC-based framework we're building. The new class uses the file system as the underlying backend for caching data, but itís also possible to create one that caches data on shared memory, a SQLite database and so forth. Indeed, numerous possibilities exist.

  1. Developing a Caching Class for an MVC-based Framework in PHP 5
  2. Review: the previous HTML helper class
  3. Building a cache class
  4. Determining cache validity
By: Alejandro Gervasio
Rating: starstarstarstarstar / 2
June 22, 2010

print this article



Without a doubt, the Model-View-Controller design pattern is one of the most useful approaches these days for developing web applications that keep their business and application logic isolated (at least partially) from visual presentation.

As a PHP developer, you may already have mastered the key concepts that surround the application of this popular structural pattern by implementing it successfully within your own web-based programs. If thatís the case, then feel free to congratulate yourself and keep up the good work.

However, itís also fair to say that there are many PHP programmers who are taking their first steps into the vast terrain of object-oriented web development and want to learn, among other things, how to apply the MVC paradigm in a real-world project.

If you belong to this second group, then I suggest you start reading this series of articles. It will teach you in a step-by-step fashion how to build a fully-functional, object-based framework that will stick to the schema dictated by the Model-View-Controller design pattern.

Of course, if youíve already read all of the articles that precede this one, then at this point youíre familiar with the foundation for building a basic MVC-driven framework like the one mentioned above. In those tutorials I began developing a set of loosely-coupled classes for tackling some common tasks, such as routing HTTP requests to the appropriate controllers and interacting with MySQL, as well as sanitizing user input and automatically generating web forms.

I know that itís still hard to see how these classes can be put to work together under the umbrella of the MVC pattern, but for the moment bear with me and be patient, since itís time to add another class to the existing stack.

Yes, as this articleís title clearly suggests, in the following lines Iím going to incorporate into the framework a basic cache class. This will give it the ability to cache both database result sets and HTML output.

Want to learn the full details for how this class will be created? Start reading now!

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


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