Re: Caching a local file using NSURLCache
Re: Caching a local file using NSURLCache
- Subject: Re: Caching a local file using NSURLCache
- From: Michael Vannorsdel <email@hidden>
- Date: Sat, 26 Apr 2008 16:03:42 -0600
I believe it would be more difficult to implement true support for a
file protocol in an NSURLCache subclass than to maintain your own
dictionary that's saved and read from your own cache file. I don't
know of any documentation on the cache file format that NSURLCache
uses, I just know it's SQL based.
A middle of the road option would be to subclass NSURLCache and
implement you're own cachedResponseForRequest: /
storeCachedResponse:forRequest: to read and write to a cache file of a
format you choose. Just check if the scheme of the URL is 'file' and
use your own cache and for other schemes pass it on to the super class.
On Apr 25, 2008, at 3:26 PM, Stephan Burlot wrote:
I was 100% sure the doc stated that NSURLCache handled file://, and
since it worked under 10.4, I didnt look further. But I just found
only http and https are cached.
I didnt want a cache for local file: in my app, I display files
which are located locally and remotely. In addition, the local files
are reduced for display, so using an unified cache for remote and
local did simplify a lot my code. Unfortunately, I have to rewrite it.
The doc says that file:// caching can be done "Custom NSURLProtocol
classes can provide caching if they choose."
If anyone has some sample NSURLProtocol code to share, I didnt found
any example that I can use.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden