How To Disable AFNetworking Cache

后端 未结 6 2186
无人及你
无人及你 2020-12-02 15:54

Is it possible to disable all the cache features from AFNetworking?

I am building my own custom cache system and don\'t want this to take up disk space too.

6条回答
  •  眼角桃花
    2020-12-02 16:29

    This may depend on your server implementation, but adding Cache-Control:no-store header to your outgoing request should result in a response that contains the same header, thus commanding NSURLCache to not cache the response to disk.

    IMHO this is a better approach than disabling disk-caching completely, especially if you're writing SDK code that will be used by other applications which may want to utilize NSURLCache.

提交回复
热议问题