NCache 4.6 - Online Documentation

ICacheLoader Interface

 
The class implementing this interface allows NCache to load data from the master data source to the cache. Therefore, this class needs to implement the logic for loading the required data from your data source. The following methods are required to be defined by the classes implementing this loader:
 
Member
Type
Description
Init
void
This method is called by NCache framework on startup, and takes as input an IDictionary of parameters which can be passed while configuring cache loader through NCache Manager. Please refer to Configure Cache Loader in Admin Guide for further details. Through the input param you can specify runtime parameters to your deployed provider like connection string.
LoadNext
LoaderResult
LoadNext() contains the logic to load object(s) from the master data source and return to an object of the LoaderResult class. This method accepts an object which indicates the state.  The data is then loaded in the cache and the state can be used to track loaded data if data is added in chunks.
The members of LoaderResult are discussed in detail later in the chapter.
 
 
LoaderResult Class
 
Member
Type
Description
Data
OrderedDictionary
An OrderedDictionary which is populated by the data being collected from the data source. Contains methods to Add, Insert, Remove data from the cache.
HasKeyDependency
bool
To check whether the item is dependent on another key or not. If specified true, the data will be added sequentially, and not in bulk.
HasMoreData
bool
To specify whether the loader result has any data remaining else the data is considered as loaded in the cache.
UserContext
object
Object to be used by the user according to requirements, can be used to indicate state.
 
 
See Also