NSFetchedResultsController *frc = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:moc sectionNameKeyPath:nil cacheName:@"Root"];
Why do we have to think about a cacheName? How important is this decision? What would happen if there are two NSFetchedResultsController instances using the exact same cacheName? Does that matter? Is that some kind of singleton stuff?
Thinking about Core Animation, there's also this strange animationID parameter, but setting it to the exact same thing for dozens of simultaneous animations doesn't hurt the animations at all. So I guess it's probably the same thing here...or not?
If you have a UITableView
with hundreds of objects that cache is very important as it will change load times from seconds to milliseconds. The trick is that a cache is one to one with its NSPredicate
. If you change the predicate the cache gets rebuilt. If you change the NSPredicate
constantly then the cache is useless.
If you have a table view that is consistent with regard to its NSFetchRequest
then the cache will drastically improve performance.
Batch size is determined when you set it and that only applies when it has to go back out to the persistent store. If there is data in the cache then it will get hit first and batch size, in my experience, is ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With