开发者

What could I do in NSURLConnection -connection:willCacheResponse:?

The documentation says, I can do:

Return Value: The actual cached response to store in the cache. The delegate may return cachedResponse unmodified, return a modified cached response, or return nil if no cached response should be stored for the connection.

What happ开发者_StackOverflowens when I return cachedResponse unmodified?

Why would I want to return a modified cached response? Examples?


If you do not modify the cachedResponse then it will be cached according to the policy in cachedResponse.storagePolicy and cachedResponse.response.

One reason you might want to override this is to prevent certain things from being cached. Say you are talking to some REST service that returns security sensitive data that you do not want to have stores in a disk cache on the iPhone. Then you could return a modified cachedResponse with the storagePolicy set to NSURLCacheStorageAllowedInMemoryOnly.

Are you just interested in how this works or do you have a problem that you think is related to caching?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜