Previous | Next
WireHose Developers Guide

Caching

WHCachingDataSource

WHCachingDataSource is an abstract class which provides all the necessary infrastructure for fetching enterprise objects into a cache, returning subsets of objects from the cache, and invalidating the cache when necessary.

If a caching datasource is created with an owner which implements the WHFetcher interface, such as a WHTagFetcher, it will use its owner's values for its properties such as fetchLimit. You can also instantiate a caching datasource and set the its properties directly; this is useful when using a caching datasource as an EODataSource for a display group, for example.

WireHose provides two concrete implementations, WHTagDataSource and WHQualifierDataSource. You can create your own by implementing fetchResourcesIntoEditingContext, which will be called as necessary by WHCachingDataSource itself.

WHConcreteFetcher

WHConcreteFetcher provides an abstract implementation of a channel which owns a caching datasource. WireHose provides two concrete implementations, WHTagFetcher and WHQualifierFetcher. WHConcreteFetcher is a full-service implementation of the WHFetcher interface, and requires minimal customization to handle new fetching behavior.

ShouldInvalidateCache notifications

To prevent caches from becoming stale, WHFetcher defines the ShouldInvalidateCache notification. Fetchers whose cache should be invalidated when a particular object changes can register for these notifications. For example, WHTagDataSource registers for ShouldInvalidateCache notifications for each of its optional and required tags, and will invalidate its cache if any of its tags are changed.

For fetchers that deal with enterprise objects, the notification object will be the globalID of the object which has changed; WHTag and the default implementation of the taggable interface will automatically post these notifications for tags.

WHConcreteFetcher and its companion WHCachingDataSource provide an implementation of the WHFetcher interface for fetching enterprise objects; they handle caching and propagation of ShouldInvalidateCache notifications.


Previous | Next