Jason
Jason

Reputation: 14605

How to cache NSFetchRequest results without NSFetchedResultsController?

Is there a way to cache NSFetchRequest results, but without using an NSFetchedResultsController? I know how to set the cache name for the results controller, but in a number of instances I just pull data from my core data store and want to cache it -- but have no need for a results controller. Any ideas on how to do this? I can't find anything in Apple's documentation.

Upvotes: 2

Views: 1410

Answers (1)

Marcus S. Zarra
Marcus S. Zarra

Reputation: 46718

You can keep it in memory in an NSArray. If you want to cache between executions of your application you can't. That portion of the NSFetchedResultsController is not published and the internal structure of Core Data is not open.

If a cache is absolutely needed then use a NSFetchedResultsController.

However, considering the speed and performance of Core Data, I would question the absolute need for a cache. I suspect performance can be gained in other areas.

Upvotes: 2

Related Questions