cache-control

Refreshing a cached Angular SPA

假装没事ソ 提交于 2019-12-07 04:01:09
问题 Basic setup: Angular 1.5 SPA served from Apache 2.4 backed by a REST api also served from Apache 2.4. I have read every technique available to allow a SPA to be fresh and updated after some application code is changed on the server. Solutions come via HTTP caching (HTTP headers) or cache busting (versioning file names for example) techniques. All of them are based on the web browser making a request to get a resource and having some mechanism to know if the content needs to be updated or can

how do I add an expiration date to an img tag?

柔情痞子 提交于 2019-12-07 02:05:52
问题 I'm using the Page Speed Firebug extension to help improve page performance. I have an image-heavy page, and one of the suggestions it made is this: Leverage browser caching The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources: http://www.mysite.com/components/com_arrcard/assets/merchant-logos/aap25.jpg (expiration not specified) I know you can set Expires or Cache-Control headers on an entire page

面向站长和网站管理员的Web缓存加速指南

自闭症网瘾萝莉.ら 提交于 2019-12-06 13:36:40
原文(英文)地址: http://www.mnot.net/cache_docs/ 版权声明: 署名-非商业性使用-禁止演绎 2.0 这是一篇知识性的文档,主要目的是为了让Web缓存相关概念更容易被开发者理解并应用于实际的应用环境中。为了简要起见,某些实现方面的细节被简化或省略了。如果你更关心细节实现则完全不必耐心看完本文,后面参考文档和更多深入阅读部分可能是你更需要的内容。 什么是Web缓存,为什么要使用它? 缓存的类型: 浏览器缓存; 代理服务器缓存; Web缓存无害吗?为什么要鼓励缓存? Web缓存如何工作: 如何控制(控制不)缓存: HTML Meta标签 vs. HTTP头信息; Pragma HTTP头信息(为什么不起作用); 使用Expires(过期时间)HTTP头信息控制保鲜期; Cache-Control(缓存控制) HTTP头信息; 校验参数和校验; 创建利于缓存网站的窍门; 编写利于缓存的脚本; 常见问题解答; 缓存机制的实现:Web服务器端配置; 缓存机制的实现:服务器端脚本; 参考文档和深入阅读; 关于本文档; 什么是Web缓存,为什么要使用它? Web缓存位于Web服务器之间(1个或多个,内容源服务器)和客户端之间(1个或多个):缓存会根据进来的请求保存输出内容的副本,例如html页面, 图片,文件(统称为副本),然后,当下一个请求来到的时候

http缓存策略

做~自己de王妃 提交于 2019-12-06 09:35:45
http缓存策略 url输入后 首次访问 或 已清除缓存 时,(浏览器无缓存数据),(向服务器请求资源), 服务器在返回(资源)和(缓存策略) ,http状态码为200;客户端拿到后将数据和缓存策略缓存到浏览器。 缓存策略 存在于响应头里 , 缓存策略主要有: 强制缓存 和 协商(对比)缓存 , 缓存策略 缓存到浏览器 或者 强制缓存 服务器响应头会有2个字段来表示,expires/cache-control。 expires   http1.0的字段 , 现在浏览器默认使用http1.1 ,http1.1后使用 cache-control代替 是一个时间戳,代表资源过期时间。 例如:Expires:Sat, 23 May 2009 10:02:12 GMT cache-control (请求和响应都可以带cache-control ) Request Cache-Control "no-cache" "no-store" "max-age" "=" delta-seconds "max-stale" "=" delta-seconds "min-fresh" "=" delta-seconds "no-transform" "only-if-cached" Response Cache-Control "public" "private" "no-cache" "no-store

Receiving unpredictable parameters in Struts2 interceptor

*爱你&永不变心* 提交于 2019-12-06 09:14:06
问题 I am aiming to write an interceptor that add some headers in response. I currently have the following interceptor public class CachingInterceptor extends AbstractInterceptor{ @Override public String intercept(ActionInvocation ai) throws Exception { HttpServletResponse response = (HttpServletResponse) getActionContext(ai).get(StrutsStatics.HTTP_RESPONSE); if(null != response) { response.setHeader("Cache-control","no-store,no-cache"); response.setHeader("Pragma","no-cache"); response.setHeader(

PHP cache header override

混江龙づ霸主 提交于 2019-12-06 08:47:25
问题 I've been through over 100 answers here, lots to try, NOTHING working?? Have a PHP based site. I need caching OFF for all .php files EXCEPT A SELECT FEW. So, in .htaccess, I have the following: ExpiresActive On # Eliminate caching for certain dynamic files <FilesMatch "\.(php|cgi|pl)$"> ExpiresDefault A0 Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform" Header set Pragma "no-cache" </FilesMatch> Using Firebug, I see the following: Cache

details of MESI protocol for multicore processors

情到浓时终转凉″ 提交于 2019-12-06 07:56:55
The details of the MESI protocol for multicore processors would be really important for me, but I can't find them anywhere. Even http://www.intel.com/content/dam/doc/manual/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf doesn't contain enough detail. For instance: assume a private L1 and shared L2 cache. If the state of a line is exclusive in L1, then is it exclusive in L2 too (or invalid, because only in one cache could be the state of a line exclusive)? And clearly, if another core writes this line, the state of the previously exclusive line in L1 becomes invalid, but how

Cache-Control Headers not respected on CloudFlare

浪子不回头ぞ 提交于 2019-12-06 03:55:36
问题 I am trying to get some html pages to be cached, the same way images are automatically cached via CloudFlare but I can't get CloudFlare to actually hits its cache for html. According to the documentation (Ref: https://support.cloudflare.com/hc/en-us/articles/202775670-How-Do-I-Tell-CloudFlare-What-to-Cache-), it's possible to cache anything with a Cache-Control set to public with a max-age greater than 0. I've tried various combinations of headers on my origin Nginx server without success.

Implementing cache control using .htaccess on Apache server

半腔热情 提交于 2019-12-06 01:59:34
问题 okay, I'm still trying to get my head around some of the caching stuff and I have gone through a couple of examples I could find on Google. I have added the following code to my .htaccess file: ### activate mod_expires ExpiresActive On ### Expire .gif's 1 month from when they're accessed ExpiresByType image/gif "access plus 3 months" ExpiresByType image/png "access plus 3 months" ExpiresByType image/jpg "access plus 3 months" ExpiresByType text/javascript "access plus 3 months" Using the

Enable image caching in development mode in Rails 3.1

倾然丶 夕夏残阳落幕 提交于 2019-12-05 10:51:59
In Rails 3.1 development mode (when using the asset pipeline), images served out of assets/images are served up with the response header "Cache Control: must-revalidate". This means that Google Chrome (and seemingly only Chrome) will attempt to re-fetch images numerous times—even during a single page view. This has resulted in screwy issues with all manners of DOM manipulation via JavaScript. To name a few: jQuery UI Draggable sometimes features a dramatic offset from the mouse cursor Adding or removing a CSS class that references an image will flash or resize while the image request (which