首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不同的NSURLRequest CachePolicies?

不同的NSURLRequest CachePolicies?
EN

Stack Overflow用户
提问于 2013-07-26 07:12:52
回答 1查看 148关注 0票数 0

如何使用各种缓存策略(NSURLRequestCachePolicy)来提高下载性能?在样例下载应用程序中,哪些是最好的解决方案?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-26 07:22:43

苹果公司提出了一份整洁的文件作为参考。

上面写着

代码语言:javascript
复制
NSURLRequestUseProtocolCachePolicy
Specifies that the caching logic defined in the protocol implementation, if any, is used for a particular URL load request. This is the default policy for URL load requests.
Available in OS X v10.2 and later.
Declared in NSURLRequest.h.
NSURLRequestReloadIgnoringLocalCacheData
Specifies that the data for the URL load should be loaded from the originating source. No existing cache data should be used to satisfy a URL load request.
Available in OS X v10.5 and later.
Declared in NSURLRequest.h.
NSURLRequestReloadIgnoringLocalAndRemoteCacheData
Specifies that not only should the local cache data be ignored, but that proxies and other intermediates should be instructed to disregard their caches so far as the protocol allows.
Available in OS X v10.5 and later.
Declared in NSURLRequest.h.
NSURLRequestReloadIgnoringCacheData
Replaced by NSURLRequestReloadIgnoringLocalCacheData.
Available in OS X v10.2 and later.
Declared in NSURLRequest.h.
NSURLRequestReturnCacheDataElseLoad
Specifies that the existing cached data should be used to satisfy the request, regardless of its age or expiration date. If there is no existing data in the cache corresponding the request, the data is loaded from the originating source.
Available in OS X v10.2 and later.
Declared in NSURLRequest.h.
NSURLRequestReturnCacheDataDontLoad
Specifies that the existing cache data should be used to satisfy a request, regardless of its age or expiration date. If there is no existing data in the cache corresponding to a URL load request, no attempt is made to load the data from the originating source, and the load is considered to have failed. This constant specifies a behavior that is similar to an “offline” mode.
Available in OS X v10.2 and later.
Declared in NSURLRequest.h.
NSURLRequestReloadRevalidatingCacheData
Specifies that the existing cache data may be used provided the origin source confirms its validity, otherwise the URL is loaded from the origin source.
Available in OS X v10.5 and later.
Declared in NSURLRequest.h.
Declared In
NSURLRequest.h
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17875128

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档