|
Making PHP Applications Cache-Friendly
One approach to minimising redundant transmission of data is the
use of Last-Modified and If-Modified-Since headers as defined in HTTP/1.1.
In this scheme, each object returned by the webserver carries a date
of last modification (a.k.a. "validator"). A user agent or proxy
cache can store this value and, upon the next reload of the same
object, issue a conditional GET query with the Last-Modified-Since
header set. The webserver will then use this header to decide
whether the client's copy of the object is still "fresh" (as recent
as the data on the server) or "stale" (older than the data on the
server). If it is fresh, there is no need to send the object again,
so the server responds with a brief "304 Not Modified" message
instead.
Modern webservers and user agents (e.g., Apache/1.3,
Netscape Navigator 4.x and above, Internet Explorer) fully support
this technique. Apache automatically handles If-Modified-Since
requests for all static objects by default.
In the case of dynamic content as generated by PHP, we have to
take care of these things manually. We need to return a meaningful
Last-Modified header and handle If-Modified-Since requests so that
the user agent gets fresh data if and only if necessary. For
Phorum, this means that we have to keep track of database updates.
If the database has not changed since the client's last request, we
can simply return 304 without bothering the DBMS at all.
[ Next Page ]
| Comments: | ||
| This is a very influential speculative novel of | Sex | 12/07/04 09:41 |
| RE: Caching In A Highly Dynamic System | Faceless | 09/23/03 09:14 |
| RE: $HTTP_IF_MODIFIED_SINCE not present | jazzz | 04/03/03 04:16 |
| Flash & PHP Cache Problem | phpMax | 08/27/02 06:16 |
| RE: PHPNuke Cacheing | Shadow | 07/03/02 08:27 |
| $HTTP_IF_MODIFIED_SINCE not present | Ed Fair | 05/02/02 15:02 |
| Cache Help please | AJA | 05/01/02 20:55 |
| GD and cache? | Toast | 04/23/02 08:15 |
| RE: Other kind of cache-ing | Michael Svazas | 03/24/02 02:32 |
| Other kind of cache-ing | Catalin BOIE | 03/07/02 05:20 |
| Kindly Help Me! | shahid | 03/02/02 09:34 |
| RE: making a wap page | Genau Junior | 02/22/02 16:32 |
| making a wap page | Can Tabur | 02/13/02 08:40 |
| Caching In A Highly Dynamic System | lucitech | 02/11/02 11:31 |
| Some general comments | terry chay | 02/03/02 09:50 |
| RE: about cookies | Lexa | 02/01/02 09:48 |
| checksum | Apokalyptik | 01/15/02 01:28 |
| RE: PHPNuke Cacheing | Webparadise | 01/04/02 17:36 |
| RE: PHPNuke Cacheing | waddy | 12/09/01 15:30 |
| RE: PHPNuke Cacheing | waddy | 12/08/01 14:31 |
| RE: PHPNuke Cacheing | ching | 12/07/01 04:24 |
| RE: PHPNuke Cacheing | Gorka Valecnia | 12/03/01 18:02 |
| RE: PHPNuke Cacheing | Svante | 12/03/01 04:27 |
| RE: PHPNuke Cacheing | jose alberto toledo | 11/30/01 10:48 |
| PHPNuke Cacheing | waddy | 11/27/01 11:28 |
| about cookies | Reza | 11/22/01 10:36 |
| $HTTP_IF_MODIFIED_SINCE not sent by default? | B@rt | 11/22/01 03:28 |
| RE: plz help mail me | Svante | 11/20/01 09:17 |
| $HTTP_IF_MODIFIED_SINCE | Paul | 11/19/01 08:24 |
| plz help mail me | Jocke | 11/17/01 20:42 |
| Affects banner impressions | CSN | 11/17/01 00:49 |
| Updating Logging | CSN | 11/16/01 17:58 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


