If your content has not changed since a certain timestamp, set this via the
the lastModifiedTime
array key when instantiating HTTP_ConditionalGet.
You can immediately call the method sendHeaders()
to set the
Last-Modified, ETag, and Cache-Control headers. The, if cacheIsValid
property is false, you echo the content.
This script emulates a document that changes every 20 seconds.
This is version: Thu, 14 Nov 2024 19:12:20 -0800
For these pages all 200 responses are sent in chunks a second apart, so you should notice that 304 responses are quicker. You can also use HTTP sniffers like Fiddler (win) and LiveHTTPHeaders (Firefox add-on) to verify headers and content being sent.
must-revalidate
Cache-Control value unless max-age
is set. To get Opera to follow the spec, ConditionalGet will send Opera max-age=0
(if one is not already set).