Check this picture: http://i54.tinypic.com/2gy7mrt.png
How to achieve that for my static files? I mean so the browser even wouldn't make a开发者_开发百科 request to server, just take the file from cache. On what static files should this method be used?
Assuming your server is Apache, have a look at mod_expire.
The static files I have configured to expire "later" are text/css
, text/javascript
, application/javascript
and image/*
.
Send 304 Not Modified
header.
I would use it on anything that is unlikely to change often - your site's logo, sprite image, etc.
If you have sent far distant expiry headers, and then decided you need to change the asset, simply append a time stamp / release, e.g. sprites.png?4000
.
精彩评论