PATH Documentation > WebObjects

Up Previous Next

Caching an Entity's Objects

Synopsis

Describes how to cache data from reference tables so that applications don't have to keep fetching the tables from the database and comparing them to what's in memory. For example, you could cache a RentalTerms table whose rows are used to populate a popup list.

Description

You can set an entity to cache its enterprise objects in memory. This caching allows Enterprise Objects Framework to evaluate queries in memory, thereby avoiding round trips to the database. This is most useful for read-only entities, where there is no danger of the cached data getting out of sync with database data. Additionally, this technique should only be used with small tables, since it fetches all of an entity's enterprise objects into memory the first time any object of this entity is needed from the database.

For example, using the sample Rentals database, you might cache the entity RentalTerms. RentalTerms objects specify check out length, cost, and deposit amount for different types of rentals--new release movies, video games, and laser discs, for example. Since the set of all RentalTerms enterprise objects is fairly small, is essentially read-only, and is used very frequently, RentalTerms is a good candidate for entity caching.

Setting an Entity to Cache Objects

Using EOModeler, check the Cache in Memory option in the Advanced Entity Inspector for the entity, or to set it programmatically, use the EOEntity method setCachesObjects ( setCachesObjects: in Objective C).

Limitations

See Also

Questions

Keywords

Revision History

4 May, 1998. Kelly Toshach. First Draft.

5 May, 1998. Greg Wilson. Added Synopsis, Questions, and Keywords.


© 1999 Apple Computer, Inc.

Up Previous Next