Serve the new content only if the file has changed since last visit.
How do I implement that?
UPDATE
Sorry not to mention it earlier,but the requested resource is web page which is requested directly,not an image.
Serve the new content only if the file has changed since last visit.
How do I implement that?
UPDATE
Sorry not to mention it earlier,but the requested resource is web page which is requested directly,not an image.
You can use a trick borrowed from rails and append the last file modification time to the include:
$fileName = 'image.jpg';
$httpLink = $fileName . '?' . filemtime( $fileName );
echo '<img src="', $fileName, '" alt="blah" />';
This will output a link like
<img src="image.jpg?1002412" alt="blah" />
Then when the file changes, the query string will also change and the browser will request the "new" file i.e.
<img src="image.jpg?1003622" alt="blah" />
Alternatively you could keep a local log of file revisions and read the revision number from a database rather than the filesystem, which may be marginally faster (and save filesystem reads, although it's not significant difference - dependant on db vs web server load).