Sergey Dunets
Sergey Dunets

Reputation: 55

How to determine if the response in NSURLCache has expired?

Is there a good way to determine if the response in NSURLCache has expired? When I call -cachedResponseForRequest: method, it returns non-nil value even for expired requests, but Cocoa connects to the server and then updates NSURLCache.

Upvotes: 1

Views: 619

Answers (1)

Woodstock
Woodstock

Reputation: 22926

You should look at the HTTP headers being returned in the response. NSURLCache will check the headers to decide if it can use the thing returned from the cache.

Upvotes: 1

Related Questions