Nsurlrequestcachepolicy Cache Policy
1> nsurlrequestuseprotocolcachepolicy = 0, the default caching policy, if the cache does not exist, is obtained directly from the server. If the cache is present, the next action will be judged based on the Cache-control field in response, such as: Cache-control fields Must-revalidata, ask the server if the data is updated, and no updates are returned directly to the user to cache the data. If it has been updated, the service side is requested. 2> Nsurlrequestreloadignoringlocalcachedata = 1, ignoring local cache data, requesting the server directly. 3> Nsurlrequestignoringlocalandremotecachedata = 4, ignoring the local cache, proxy server, and other mediations, directly requesting the source service side. 4> Nsurlrequestreloadignoringcachedata = Nsurlrequestreloadignoringlocalcachedata 5> Nsurlrequestreturncachedataelseload = 2, the cache is used, regardless of its validity (that is, ignoring the Cache-control field), no request server. 6> nsurlrequestreturncachedatadontload = 3, anyway load local cache. Fail without it. (determines that no network is currently used) 7> Nsurlrequestreloadrevalidatingcachedata = 5, the cached data must be validated by the server to be used ( Seems to be a case in Nsurlrequestuseprotocolcachepolicy) Tips:url Loading System supports only the following 5 protocols: only/HTTP and https://are available for caching policies. (1)/HTTP (2) https://(3) ftp://(4) file://(5) data://
iOS cache policy