简体   繁体   中英

Cache-control values for last-modified caching?

I'm completely new to the caching systems, so I'm trying to find out what values I need to input to use a "last modified" system for caching. I've looked everywhere I'm able, but I can't get a straight answer on last-modified caching.

What do I need to put into the header to enable this caching method? Or is this method in use as default, hence why I can't see instructions?

For HTTP, you might consider the use of the ETag response header and the If-None-Match request header, and/or the use of the Last-Modified response header and the If-Modified-Since header; see if-modified-since vs if-none-match for a good discussion of these techniques.

The key is for the client to know when the resource was modified ; the Cache-Control directives don't really allow for proactively informing a client of when the resource was modified outside of any expiration policy, and thus other headers are needed for modification detection. That's where ETag (a value that uniquely identifies that version of the resource ), and/or Last-Modified (a timestamp of when that version of the resource was last modified) come into play.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM