[问题] 请问有关UseProtocolCachePolicy

楼主: fightword (呼啦啦~)   2017-06-28 09:12:35
找到另一篇解释更详细的
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

Links booklink

Contact Us: admin [ a t ] ucptt.com