Configure Cache Startup Loader and Refresher
- This feature is only available in NCache Enterprise.
- Before configuring the cache loader and refresher, make sure that the cache is stopped.
The cache startup loader/refresher can be configured in the following ways:
Using the NCache Management Center
Launch the NCache Management Center by browsing to http://localhost:8251 or
<server-ip>:8251on Windows and Linux.
In the left navigation bar, click on Clustered Caches or Local Caches based on the cache to configure.
Against the cache name, click on View Details.
This opens up the detailed configuration page for the cache. Go to the Advanced Settings tab and click on Cache Loader/Refresher in the left bar.
Check the Enable Cache Loader and Refresher checkbox to enable other configuration options.
Configure the Cache Loader
For Java, before deploying your JAR files, you need to make sure that:
- You have JDK 11 installed
- Your Environment Variable for Java is set
- Click on the Browse button against Assembly Name to select the assembly implementing the
The name of the selected assembly will appear in Assembly Name and any classes implementing the user-defined interface will be listed in the Class Name list box.
Select the required class.
You can also add the parameters for your cache loader implementation if required. Provide the Parameter name and Value and click on + to add the parameters. These will be displayed in the box with the option to remove the parameter.
Specifying parameters is optional. It is only required if your implementation of
ICacheLoader requires parameter(s) during initialization.
- You can add Datasets to your loader implementation as well. A Dataset is a way for you to group similar data - so it loads together. This also makes refreshing the data easier. Under the Datasets section, click on the Add Dataset button. This will take you to the following screen, where you need to give your dataset a meaningful name.
- Click on OK and Save Changes to save your cache loader's configuration.
Configure the Cache Refresher
To configure the Cache Refresher, you must provide Datasets to your implementation, in the same way you've done for the Cache Loader.
Refreshing any dataset is optional. But if you plan on using Cache Refresher to refresh the dataset, you need to check the Refresh this dataset at the following schedule checkbox.
You have the following four refresh scheduling options available to you:
- Interval: Interval-based scheduling allows you to specify a recurring time after which you want the Loader service to refresh your dataset. This option takes value in minutes which are counted after the cache starts.
- Daily: The daily scheduling option allows you to specify the exact time of the day at which you want the Loader service to refresh your dataset. This option provides you with a time chart, making it easier for you to choose the time. The time specified will be the local time of your coordinator node.
- Weekly: The weekly option allows you to specify the time as well as days of the week on which you want the Loader service to refresh your dataset. You can choose the time from the time chart and select the days from the list on the NCache Management Center.
- Monthly: Monthly scheduling of Cache Refresher allows you to specify the time stamp, as well as the days of a month on which you want the Loader service to refresh your loaded dataset. You have the following two ways of selecting the days:
- You can either specify the exact day of the month (as in number) OR
- You can select weeks and their respective days.
Select the refresh schedule of your preference and click on the OK button to add the custom dataset to your Loader/Refresher implementation.
- Repeat the same process if you want to add more than one dataset.
- To edit or remove a dataset, click on the Actions button against the dataset to perform the desired operation.
Under the Options section, you have multiple configurable options to customize the Cache Refresher usage.
- Refresh Interval: This term refers to the interval after which the dedicated thread checks the cache for any datasets to refresh. By default, the refresh interval is 900 seconds. You may specify a different value using the Refresh-Interval box.
The recommended value of he refresh interval is at least 600 seconds.
Number of Retries: This is the number of times NCache attempts a failed operation after its initial failure. By default, the number of retries is 0. You can specify if you want NCache to perform any failed operation again before proceeding to the next. Specify this number in the No. of Retries box.
Retry Interval: This is the interval by which the user determines how long to wait before trying to execute a failed operation. By default, the retry interval is 0 seconds, but you can configure it by adding a value in the Retry-Interval box.
Poll-Based Refresh Interval: You can also implement your method to trigger poll-based dataset refreshing. This is your custom implementation that is triggered after every Refresh Interval and returns a list of datasets that should either be refreshed immediately or within 24 hours. To enable this poll-based refreshing, check the "Poll for dataset names to refresh at every refresh interval" checkbox.
Once the configurations have been made, click on Deploy Cache Loader to copy the cache loader and refresher assemblies to all nodes.
Click on Save Changes to apply this configuration to the cache.
Add the Startup Loader
The Add Startup Loader tool enables the users to configure the startup loader and refresher provider for the cache which loads the configured datasets from the data source to the cache whenever the cache starts.
This command configures a startup loader for a cache named demoCache. The assemblies to be deployed are placed at the specified path and the default port 8250.
Add-StartupLoader –CacheName demoCache –AssemblyPath C:\Loader.dll -Class StartupLoader.Loader
Add the Loader Dataset
The Add Loader Dataset tool enables the users to add datasets to a cache with cache loader and cache refresher configured.
This adds dataset on cache loader/refresher configured demoCache that will refresh itself after an interval of 5 minutes from cache start.
Add-LoaderDataset -Dataset order -CacheName demoCache -ScheduleExpression 0:00:00:05 -ScheduleOption DailyInterval
Remove the Loader Dataset
The Remove Loader Dataset tool enables users to remove dataset from the cache with enabled cache startup loader and cache refresher.
This removes a dataset from server 184.108.40.206 of a cache named demoCache.
Remove the Startup Loader
The Remove Startup Loader tool enables the users to remove the preconfigured loader and refresher from the specified cache.
It removes the startup loader/refresher for the cache named demoCache using the default port from server 220.127.116.11.