• Products
  • Solutions
  • Customers
  • Resources
  • Company
  • Pricing
  • Download
Try Playground
  • Server-side API Programming
  • Loader and Refresher
  • Components of Loader/Refresher
Show / Hide Table of Contents
  • Programmer's Guide
  • Setting Up Development Environment
    • .NET
      • Client API Prerequisites
      • Server-side API Prerequisites
    • Java
      • Client API Prerequisites
      • Server-side API Prerequisites
    • Python
      • Client API Prerequisites
    • Node.js
      • Client API Prerequisites
  • Client Side API Programming
    • Error Handling
    • Troubleshooting
    • Cache Keys and Data
    • How to Connect to Cache
    • Basic Operations - An Overview
      • Add Data
      • Update/Insert Data
      • Retrieve Data
      • Remove Data
    • Groups
      • Overview
      • Add/Update Data with Groups
      • Retrieve Data with Groups
      • Remove Data with Group
      • Search Group Data Using SQL
      • Delete Group Data Using SQL
    • Tags
      • Overview
      • Add/Update Data with Tags
      • Retrieve Data with Tags
      • Remove Data with Tags
      • Search Tag Data Using SQL
      • Delete Tag Data Using SQL
    • Named Tags
      • Overview
      • Add/Update Data with Named Tags
      • Remove Data with Named Tags
      • Search Data with Named Tags Using SQL
      • Delete Data with Named Tags Using SQL
    • Expirations
      • Overview
      • Absolute Expiration
      • Sliding Expiration
    • Data Dependency
      • Key Dependency
      • Multi-Cache Dependency
    • Dependency on Database
      • SQL Server
      • Oracle
      • OleDB with Polling
      • CLR Procedures in SQL Server
    • Dependency on External Source
      • File Dependency
      • Custom Dependency
      • Aggregate Dependency
    • Locks
      • Types of Locking
      • Pessimistic Locking
      • Optimistic Locking
    • SQL Query
      • Overview
      • Define Indexes Programmatically
      • Query with ExecuteReader and ExecuteScalar
      • Delete Data with ExecuteNonQuery
      • SQL Reference
    • LINQ Query
      • Overview
      • LINQ Query for Objects
      • LINQ Reference
    • Data Structures
      • Overview
      • List
      • Queue
      • Set
      • Dictionary
      • Counter
      • Invalidation Attributes
      • Searchable Attributes
      • Query on Data Structures
      • Remove from Data Structure
    • Events
      • Cache Level Events
      • Item Level Events
      • Management Level Events
    • Pub/Sub Messaging
      • Overview
      • Topics
      • Publish Messages
      • Subscribe to a Topic
      • Pub/Sub Events
    • Continuous Query
      • Overview
      • Use Continuous Query
    • Stream Processing
      • Add/Update Stream Data
      • Retrieve Stream Data
    • JSON
      • Overview
      • Use JSON Objects
      • Query JSON Data
    • Security API
      • Login with Credentials
    • Management API
    • Clear Cache
    • Error Logging
    • Location Affinity
  • Server-side API Programming
    • Loader and Refresher
      • Overview
      • Implement Loader and Refresher
      • Components of Loader/Refresher
    • Data Source Providers
      • Read-through
        • Implement Read-through
        • Use Read-through
      • Write-through
        • Implement Write-through
        • Use Write-through
        • Use Write-behind
    • Custom Dependency
      • Implement Extensible Dependency
      • Implement Bulk Extensible Dependency
      • Implement Notify Extensible Dependency
    • Bridge Conflict Resolver
    • Entry Processor
      • Overview
      • Implement Entry Processor
    • MapReduce
      • Overview
      • Implement MapReduce
      • Use MapReduce
    • MapReduce Aggregator
      • Overview
      • Implement and Use Aggregator
    • Compact Serialization
  • Client Side Features
    • ASP.NET Core Caching
      • Session Storage
        • Session Provider
        • IDistributedCache
        • Sessions Usage
        • Multi-site Session Provider
        • Session Sharing with ASP.NET
      • SignalR
        • NCache Extension for SignalR Core
      • Response Caching
        • Configure and Use
        • Configure with IDistributedCache
      • Data Caching
        • NCache API
        • IDistributedCache API
      • Data Protection Provider
        • Configure
    • Java Web App Caching
      • Web Sessions
        • Overview
        • Configure App
          • Add Maven Dependencies
          • Deploy Application
        • Multi-site Sessions
    • Node.js App Caching
      • Web Sessions
    • ASP.NET Caching Benefits and Overview
      • ASP.NET Session State Provider Properties
      • Multi-region ASP.NET Session State Provider Configuration
      • Session Sharing between ASP.NET and ASP.NET Core
      • ASP.NET SignalR Backplane
        • NCache Extension for SignalR
      • ASP.NET View State Caching
        • View State Content Optimization Configuration
        • Group View State with Sessions
        • Limit View State Caching
        • Page Level Grouping
      • ASP.NET Output Cache
        • Output Caching Provider Overview
        • Output Cache with Custom Hooks
  • .NET Third Party Integrations
    • Entity Framework (EF) Core
      • Installation
      • Configure
      • EF Core Extension Methods
        • Extension Methods
        • Cache Handle
        • Caching Options
        • Query Deferred API
      • Logging in EF Core
    • Entity Framework EF 6
      • EF Second Level Cache
      • EF Caching Resync Provider
      • EF Caching Configuration File
    • NHibernate
      • Second Level Cache
      • Query Caching
      • Synchronize Database with Cache
    • Debug NCache Providers in Visual Studio
  • Java Third Party Integrations
    • Hibernate
      • Second Level Cache
      • Configure Cacheable Objects and Regions
      • Configure Application
      • Query Caching
    • Spring
      • Overview
      • Use NCache with Spring
        • Configure Generic Provider
        • Configure JCache Spring Caching Provider
        • Configure Caching Declaration
        • Configure Spring Sessions
    • JCache API
      • CRUD Operations
      • Expiration
      • Events
  • Third-Party Wrappers
    • AppFabric to NCache Migration
      • AppFabric API vs. NCache API
      • Configuration Differences Between AppFabric and NCache
      • Migrating from an AppFabric Application to NCache
    • Redis to NCache Migration
      • Redis to NCache Migration
    • Memcached Wrapper
      • Memcached Gateway Approach
      • Memcached Client Plugin for .NET

Components of Cache Loader/Refresher

This pages describes the components of cache loader/refresher and how to configure them for loading and refreshing data from configured data source.

Note

The Cache Loader and Refresher are [Deprecated] for NCache Java.

ICacheLoader Interface

To configure the Cache Loader and Refresher, ICacheLoader interface needs to be implemented and then configured using the NCache Management Center or Command Line Tools. NCache uses this custom provider to load and refresh data from the configured data source.

Important

Make sure that the NCache Execution Service is running and the firewall is disabled.

The class implementing this interface allows NCache to load and refresh 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 Loader and Refresher:

Member Type Description
Init void This method is called by NCache on startup and takes an IDictionary/Map of parameters as input which can be passed while configuring Cache Loader/Refresher. Through the input parameters, you can specify runtime parameters to your deployed provider like connection string, etc.
LoadDatasetOnStartup object LoadDatasetOnStartup contains the logic to load data from the master data source and return an object. This method takes a string dataset that includes the data to be loaded in the cache.
LoadNext (Legacy API available until NCache 5.1) LoaderResult It is the Legacy API implementation for loading cache data on startup. 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.
RefreshDataset object RefreshDataset contains the logic to refresh data that has been loaded in the cache. This method takes the UserContext returned by LoadDatasetOnStartup to understand which data it needs to refresh. When invoked, this method fetches fresh data from the data source based on the UserContext it receives.
GetDatasetToRefresh Dictionary GetDatasetToRefresh takes UserContext and iterates over it to assign RefreshPreference to each dataset. It returns a dictionary containing dataset to refresh with it's respective RefreshPreference.
Dispose void Dispose method frees up resources by disposing the Loader/Refresher.

cache-loader tag

NCache adds the configured datasets under the <cache-loader> tag into config.ncconf, which are then fetched in the client application.

Note

These datasets are specified through the NCache Management Center as explained in Configure Cache Startup Loader.

<cache-loader retries="0" retry-interval="0" enabled="True" refresh-on-event="False" refresh-interval="900">
      <provider assembly-name="Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" class-name="Loader.Loader" full-name="Loader.dll"/>
      <parameters name="connString" value="abc"/>
      <datasets>
        <dataset name="products" schedule-expression="0:1,5:12:00" schedule-option="Weekly"/>
        <dataset name="orders" schedule-expression="0:00:00:20" schedule-option="DailyInterval"/>
        <dataset name="customers" schedule-expression="0:00:00:00" schedule-option="DailyTime"/>
        <dataset name="stock" schedule-expression="0:1,15,L:10:00" schedule-option="Monthly"/>
        <dataset name="discount" schedule-expression="1,L:5,6:09:52" schedule-option="Monthly"/>
        <dataset name="sale" schedule-expression="" schedule-option=""/>
      </datasets>
    </cache-loader>


Properties Description Format
retries Number of retries to perform any failed operation before the next operation. The default value is 0 seconds. -
retry-interval The time interval between each retry attempt to perform the failed operation. The default value is 0 seconds. -
enabled Determines whether the Refresher is enabled or not. The default value is False. True/False
refresh-on-event Determines whether to enable/disable poll-based refreshing. The default value is False. True/False
refresh-interval The time interval after which the refresh thread is invoked to fetch data to be refreshed. The default value is 900 seconds. -
assembly-name Human-understandable name of the deployed Cache Loader assembly. Essentially, it refers to the name of the .dll or jar file that users have identified their class libraries in. -
class-name Name of class implementing the ICacheLoader interface. -
full-name Name of assembly to be deployed. -
name Under parameters is the name of the added parameter. -
value Under parameters is the value of the added parameter. -
name Under dataset is the name of the added dataset. This is a unique string. -
schedule-expression Refresh the schedule expression of the dataset. This expression can either be for minutes, hours, days, weeks, or months.
    For DailyInterval: 0:00:00:mm

    For DailyTime: 0:00:hh:mm

    For Weekly: 0:day(s):hh:mm:ss

    For Monthly: week(s):day(s):hh:mm
schedule-option Refresh the schedule option of the added dataset. DailyInterval/ DailyTime/ Weekly/Monthly

See Also

.NET: Alachisoft.NCache.Runtime namespace.
Java: com.alachisoft.ncache.runtime.cacheloader namespace.

In This Article
  • ICacheLoader Interface
  • cache-loader tag
  • See Also

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Professional
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - 2025. All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top