NCache 4.6 - Online Documentation


NCache  provides Cache Startup Loader through which cache can be preloaded with data as it starts up. This is useful for applications which depend on certain data and that data should be available to the application immediately after it begins executing. For example, a video streaming site could have hundreds or thousands of videos at the beginning, and later new videos could be added on the server. For such an application, cache can be preloaded with existing videos on cache startup instead of manually adding the data in it.
To configure Cache Startup Loader, CacheLoader interface provided by NCache needs to be implemented and then deployed using manager. NCache will use that custom provider to load data from the configured data source. Cache can be preloaded  by loading data in it either at once or in chunks. On cache startup, NCache framework will iteratively call LoadNext method of this custom provider until it returns false. In this method, logic to return data at once or in multiple chunks can be implemented. The size of the added chunk in cache from data source can also be controlled. In short, NCache provides flexible ways to load data into cache.
Cache Loader may fail to load data due to an unsuccessful connection with the data source or if an incorrect index is specified while extracting data from the data source. To identify this, server side cache logs for Cache Loader must be checked for errors/exceptions.
NCache loads data from data source on cache startup and populate it in cache in a separate thread. In case of clustered cache, only the coordinator node will be responsible for loading items in cache. If a node crashes or gets gracefully down while Cache Loader is in progress, then the next node will be responsible for initiating the Cache Loader from start.
The Cache Loader process can be delayed for a certain interval through Cache Loader start up delay configuration. By default its value is 20 seconds and it can be changed by providing NCacheServer.CacheLoaderStartupDelay key along with its value in NCache service XML file.
See Also