What cachesObjects on EOEntity can and can not do

From EOFWiki
Jump to navigationJump to search

If you set cachesObjects on an EOEntity to YES, MulleEOF will try to avoid database accesses completely and use in-memory data to satisfy fetch requests.

Technically, on the first access to the database for that EOEntity, MulleEOF fetches all the objects' data and stores it as EODatabase snapshots. Then the snapshots are qualified and sorted in-memory to satisfy the original fetch request, from that EOFaults are produced and resolved to provide the objects.

MulleEOF will use regular fetches to the database, if it can't handle the EOQualifier of the EOFetchSpecification in memory.

A few considerations to keep in mind, if you want to use this feature.

  • the EOEntity should be fairly simple. If it has EORelationships, especially toMany EORelationships caching may not be useful.
  • using an agressive snapshot invalidation scheme, will make this useless
  • EOQualifiers need to be in-memory qualifiable
  • for best performance, EOQualifiers should only qualify the fetchedAttributes of that EOEntity
  • since all object data is cached in memory, the number of objects to cache should be fairly small
  • a database is made for qualifying large sets of data, trust it
  • using derived EOAttributes may or may not work as expected