views:

19

answers:

1
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?

+1  A: 

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.

Update

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.

Marcus S. Zarra
but isn't NSFetchedResultsController always fetching the content in batches? I thought it would never load 100 objects at once...or is that only the case when figuring out the table structure at the beginning?
dontWatchMyProfile