作者fightword (呼啦啦~)
看板MacDev
标题[问题] 请问有关UseProtocolCachePolicy
时间Wed Jun 28 09:12:35 2017
找到另一篇解释更详细的
http://www.jianshu.com/p/aa49bb3555f4
===========================
最近在研究cache的机制
看了这篇
http://nshipster.cn/nsurlcache/
跟
https://developer.apple.com/documentation/foundation/nsurlrequest.cachepolicy/1411223-useprotocolcachepolicy
还是没有搞懂
想问一下
如果我cache设定为useProtocolCachePolicy, 大小也配置好了。
Server的回应Header里也有设定Cache-Control
程式就会依照Cache-Control设定好的时间存cache吗?
PS.这篇有提到一点
http://www.hpique.com/2014/03/how-to-cache-server-responses-in-ios-apps/
The shared NSURLCache gives us much out of the box.
If our server uses Cache-Control HTTP headers a sets the maximum age
for its responses, both the shared NSURLSession (iOS 7 only)
and NSURLConnection will respect this and return cached responses
before they expire.
We don’t need to write any code to get this functionality
但在Apple的文件我是找不到,希望有经验的人能指导一下
3Q
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.32.190.119
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MacDev/M.1498612359.A.FA7.html
※ 编辑: fightword (114.32.190.119), 06/28/2017 09:17:36
※ 编辑: fightword (114.32.190.119), 06/30/2017 11:48:59