Read-through Cache Provider
Namespace:
For enabling Read-through caching, you need a reference of the following assembly in your application:
NCRuntime.jar
This assembly contains class implementing com.alachisoft.ncache.runtime.DatasourceProviders.ReadThruProvider interface provided by NCache. The class implementing this interface gets notification requests to load the data from the master datasource if not available in the cache. Thus, the class needs to include the logic for loading the data from the datasource to the cache.
Following import statements are required in your project for using Read-Thru provider:
import com.alachisoft.ncache.runtime.datasourceprovider.ReadThruProvider;
Read-Through Interfaces:
In order to use Read-Thru cache provider in your application, implement the following methods:
public void start(HashMap parameters) throws Exception;
public void loadFromSource(String string, ProviderCacheItem pci) throws
Exception;
public HashMap<String, ProviderCacheItem> loadFromSource(String[] strings)
throws Exception;
public void stop() throws Exception;
See Also