You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Sethi, Raman" <ra...@sap.com> on 2013/09/20 00:46:59 UTC

NSURLCache from disk behavior

We have an enterprise app, a part of which is online and we are seeing that NSURLCache works fine when the cache bits are served from the memory.

Now if the app exited and is restarted (as opposed to resumed) NSURLCache is not serving the pages from the disk (as memory cache is wiped)

The disk part of the cache below seems to be populated as the sqlite DB is not empty and is growing in size as the online part of the application is browsed
but returns nil when asked for the cached copy of the document.

Has anybody run into this ?

int cacheSizeMemory = 8 * 1024 * 1024; // 8MB
int cacheSizeDisk = 32 * 1024 * 1024; // 32MB
NSURLCache* sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];
[NSURLCache setSharedURLCache:sharedCache];

Thanks

Raman

Re: NSURLCache from disk behavior

Posted by Shazron <sh...@gmail.com>.
See: https://issues.apache.org/jira/browse/CB-3071


On Thu, Sep 19, 2013 at 3:46 PM, Sethi, Raman <ra...@sap.com> wrote:

> We have an enterprise app, a part of which is online and we are seeing
> that NSURLCache works fine when the cache bits are served from the memory.
>
> Now if the app exited and is restarted (as opposed to resumed) NSURLCache
> is not serving the pages from the disk (as memory cache is wiped)
>
> The disk part of the cache below seems to be populated as the sqlite DB is
> not empty and is growing in size as the online part of the application is
> browsed
> but returns nil when asked for the cached copy of the document.
>
> Has anybody run into this ?
>
> int cacheSizeMemory = 8 * 1024 * 1024; // 8MB
> int cacheSizeDisk = 32 * 1024 * 1024; // 32MB
> NSURLCache* sharedCache = [[NSURLCache alloc]
> initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@
> "nsurlcache"];
> [NSURLCache setSharedURLCache:sharedCache];
>
> Thanks
>
> Raman
>