开发者

Static files fully from cache?

开发者 https://www.devze.com 2023-01-29 20:39 出处:网络
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 c

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消