BigMemory 4.3.7 | Product Documentation | BigMemory Max Developer Guide | Refresh Ahead | Implementing the CacheLoader
 
Implementing the CacheLoader
Implementing CacheLoaderFactory through the BigMemory Max API is required to effect reloading of entries for refresh-ahead operations. In configuration, specify the concrete class that extends net.sf.ehcache.loader.CacheLoaderFactory and call createCacheLoader(myCache, properties) to create the cache's cache loader. For example, if the configured concrete class is the following:
<cache name="myCache" ...
<cacheLoaderFactory class="com.company.my.ConcreteCacheLoaderFactory"
Properties="some_property=1, some_other_property=2" />

<!-- Additional cacheLoaderFactory elements can be added.
These form a chain so that if a CacheLoader returns null,
the next in line is tried. -->

...
</cache>
then it can be used programmatically:
CacheLoader cacheLoader = ConcreteCacheLoaderFactory.createCacheLoader
    (myCache, properties);
// Custom properties can be passed to the implemented CacheLoader.
Note that cacheLoader must implement the CacheLoader.loadAll() method to load the refreshed entries.