Home arrow PHP arrow Output Caching with PHP

Output Caching with PHP

Dynamic Web pages take longer to load than static ones, which forces visitors to your site to wait -- and we all know they won't wait for very long. Output caching is a powerful technique you can use to shorten that wait and keep them from leaving.

TABLE OF CONTENTS:
  1. Output Caching with PHP
  2. Capturing Server Side Output
  3. Output Buffering for Server Side Caching
  4. Multiple caching: splitting the Web page content
  5. Putting it All Together
By: Alejandro Gervasio
Rating: starstarstarstarstar / 64
January 11, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

If we take a nostalgic look at those distant days when developing Websites consisted of writing a few, static HTML pages, made up mostly of text and scarce images, we notice that the process of sending a Web page from the Web server to a Web browser was painless and straightforward. The server had to fetch some files from the file system, and send them happily to the userís browser, which received the parsed page almost immediately.

Once the page was displayed, the browser would trigger its caching routines to store the finished page on the user's computer, until a new request was made for that page. With a new request for that page, the browser performed a fast check with the Web server to make sure the page hadnít been updated, and then could display the cached, locally stored version. Ah, memories! 

As you know, the Web became more and more complex, and new techniques had to be developed for delivering dynamic content. Most  websites migrated from static to dynamic schemas, according to current demands for satisfying content-hungry visitors. This new context rapidly broke the well-established process described above.

Now, nearly every page requested puts into action some kind of intermediate process (or many of them) that introduces a noticeable delay when delivering Web pages to the end user. If you are within the field of PHP processing, you know that the Web server will call the PHP engine for parsing scripts, and maybe those scripts will connect to databases, and so on, all of this resulting in a lag between the userís request for a page and the final display in the browser.

If keeping our applications simple is not mandatory, they will become more complex, and easily cause us to run into difficulties that could increase the lag problem. There are many possible approaches to solve this situation. In this article, we will see how server side caching can help us to implement simple but powerful PHP mechanisms to avoid, or reduce, the delay between a Web server sending a dynamic page and the user seeing the finished result displayed on the machine.



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