The "Error Document" is probably just referring to the HTTP status code, specifically the 304 Not Changed
status. One might call it 'lazy caching' because on a static web site you usually wouldn't need to do anything to set it up.
How it would work on a static web site:
- Browser requests URL.
- Server returns response, including
Last-modified: [last modified date of static file]
header.
- Browser requests same URL later, including
If-Modified-Since: [last modified date from first request]
request header.
- Server returns
304 Not Modified
response.
Since a dynamic page obviously can't rely on the modified date of a document, you do have to go out of your way to implement this sort of caching. It works exactly the same way, but rather than rely on the HTTP server to do anything automatically, you calculate the Last-modified
date based on a database value (or whatever) and send that with every response. Then when you get a request containing an If-Modified-Since
header, you can skip any processing after what is needed to calculate the last modified date and just send a 304 Not Modified
response, potentially saving a ton of bandwidth and CPU cycles.
Here's an example in PHP to get you started if that's what you're looking for.