Cache Client

The example below shows the usual way of registering a cache loader and using the cache.

Figure 1. Registering a cache loader and using the cache
...
public class MyCacheClient {
  // keep a static reference to mycache
  private static Cache<Integer, 
            ReadWorkQueueDetails> myCache;

  static {
    // retrieve a reference to mycache and register 
    // the cache loader
    myCache = CacheManager.getDefaultCacheGroup()
                               .getCache("mycache");
    myCache.registerCacheLoader(new MyCacheLoader());
  }

  public WorkAllocation() {
...
  }
...
  // use the cache
  ReadWorkQueueDetails wq = myCache.get(1);
...