In general web development, it is sometimes necessary to set a special HTTP response header to prevent a client (typically a browser) from caching (using) the response of that request.
At this time most developers are Baidu or Google a few pieces of code to copy and paste the matter.
The following is a brief description of the actual role of several HTTP response headers for cache control.
1 //prevents clients from replicating the contents of the response to the cache area2 Header(' Cache-control:no-store ');3 4 //the next time the client requests cache validity validation, the corresponding result is not used5 Header(' Cache-control:no-cache ');6 7 //Set Cache validity period is 0, client next request does not use cache8 Header(' Cache-control:max-age=0 ');9 Ten //The next time the client requests, the cache validity must be re-validated and reused One Header(' cache-control:must-revalidate ');
Attention:
Expires:xxxxx the response header in this format is also available, but is not recommended because the value is the actual expiration time rather than the time remaining, but the client and server time are not necessarily consistent.
HTTP response Header Cache control