ASIHTTPRequest - 设置忽略缓存/代理
我正在使用 ASIHTTPRequest 并从我们的服务器上提取内容,该服务器上有 Squid 缓存。看来 ASIHTTPRequest 没有获取最新的内容版本。
我怎样才能告诉它忽略缓存以便我可以获得最新版本?或者有更好的方法来做到这一点?
以下是我正在使用的:
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:serviceUrl];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
[request setCachePolicy:ASIAskServerIfModifiedCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy];
[request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
[request setTimeOutSeconds:50.0];
[request addRequestHeader:@"CacheControl" value:@"no-cache"];
[request startSynchronous];
I am using ASIHTTPRequest and pulling content from our server which has Squid cache on it. It seems that ASIHTTPRequest is not getting the newest content version.
How can I tell it to ignore the cache so that I can get the newest version? Or is there a better way to do this?
The following is what I am using:
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:serviceUrl];
[request setDownloadCache:[ASIDownloadCache sharedCache]];
[request setCachePolicy:ASIAskServerIfModifiedCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy];
[request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
[request setTimeOutSeconds:50.0];
[request addRequestHeader:@"CacheControl" value:@"no-cache"];
[request startSynchronous];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来标头应该是:
应该告诉squid从服务器获取请求,但这取决于squid服务器的配置。也许这个功能被禁用了?
您可以在浏览器中强制重新加载吗?
我认为无缓存只是意味着服务器不应更新其缓存。
It looks like the Header should be:
That should tell squid to fetch the request from the server, but that depends on the configuration of the squid server. Maybe this feature is disabled ?
Can you do a forced reload in a browser ?
I think no-cache just means that the server should not update it's cache.