caching with php

liunx

Guest
Wondering if anyone could provide a way to cache only images through php headers, came across a way with an apache module, having some trouble finding a php script to do the same task.This causes pages not to be cached... from the manual. <!-- m --><a class="postlink" href="http://us3.php.net/manual/en/function.header.php">http://us3.php.net/manual/en/function.header.php</a><!-- m -->
I don't know if it keeps the images though. I don't get the whole header thing yet so I can't tell you more but give you a push in this direction. :-)

<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>no, and what is the difference? what is wrong with caching the page?I use a php script to insert the latest threads from the forum, as well as the forum info (number of members on, etc.).

It's a bummer that you can't set one content type to cache for longer than another (ie setting jpegs to cache for 30 days whilst setting the content to cache for 3).like I said, who cares. if it was cached once it will be there until the user deletes it. being serverside it usually gets updated at everyload. that is the beauty of serverside. (of course the user can set it to never cache in IE) sure the html gets cached, but it will always check the page being loaded and sees if it is different than what is in the temporary internet files. if it is different than it loads form the net, if the date is the same than it loads from cache.

again, who cares how long the image stays or the text.
 
Back
Top