V-Xtreme V-Xtreme -4 years ago 104
Objective-C Question

Persisting the contents of NSCache

I am using NSCache to store the webData.

webData=[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:urlString]];
[cache setObject:webData forKey:urlString];

The cache will be exist only when my application is running. I want to persist the contents of cache though the application is quit. Writing the contents into the disk is one of the way.Is there any other way ? if not what is efficient way to write the cache into the disk?

Answer Source

Use CoreData as CoreData does is persistency of object graphs with purging and pruning capabilities.

Refer this for tutorial

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download