The CheckModifiedDate function in the Caching Library handles all HTTP caching-related aspects that are performed by the web servers for static content. It takes four parameters:
- Last modified date/time (Date).
- Forced validation (Boolean). True if you want browsers to check the content validity each time they present the content to the end user (equivalent to pre-expiring content, while still allowing the content to be cached).
- Private cache (Boolean). True if the content should not be cached in public caches (use for user-specific content).
- Entity tag (String). The entity tag (context) of the content. Ignored if set to NULL; otherwise, compared to the If-Match header. If your web site supports user authentication, you would use the user ID or username as the entity tag.
The function checks the HTTP version of the client and quits if the client doesn’t support HTTP/1.1. (Whole content is always returned to those clients.) For HTTP/1.1 clients, the client-supplied If-Modified-Since header is compared with the Last modified date/time parameter and the client-supplied If-None-Match header is compared with the Entity tag parameter. If both match, request processing is stopped, the output buffer is cleared, and the status code 304 (not modified) is returned to the client.
Before returning to the caller, the function also sets the Last-Modified, Cache-Control, and ETag response headers.