找到另一篇解釋更詳細的
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