What is needed to provide cacheName for NSFetchedResultsController?

NSFetchedResultsController *frc = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:moc sectionNameKeyPath:nil cacheName:@"Root"]; 

Why should we think about cacheName? How important is this decision? What happens if there are two instances of NSFetchedResultsController using the same cacheName? Does it matter? Is this some kind of plain material?

Thinking about Core Animation, this strange animationID parameter is also present there, but setting it to the same thing for dozens of simultaneous animations will not damage the animation at all. So this is probably the same here ... or not?

+4
source share
1 answer

If you have a UITableView with hundreds of objects, the cache is very important, as it will change the load time from seconds to milliseconds. The trick is that the cache is one on one with its NSPredicate . If you change the predicate, the cache will be restored. If you change NSPredicate constantly, then the cache is useless.

If you have a table view that is consistent with its NSFetchRequest , then cache will significantly improve performance.

Update

The batch size is determined during its installation and applies only when it must return to the permanent storage. If there is data in the cache, then it will go first, and the lot size, in my experience, will be ignored.

+4
source

Source: https://habr.com/ru/post/1312735/


All Articles