Use NCache for ASP.NET Caching
After successfully configuring NCache, you are now ready to use it within your ASP.NET applications. NCache provides support for advanced features of ASP.NET such as Sessions, View State Caching, Output Cache and SignalR BackPlane.
Sessions: NCache provides high performance in-memory ASP.NET session clustering for web farms that is faster and more scalable than storing them in a database because sessions are kept in memory, closer to the ASP.NET application.
View State Caching: NCache View State Caching reduces the request/response time which improves the overall request time. Also NCache being a distributed, in-memory cache which is synchronized across all web servers, is able to find the
View Statevalue in the cache without any problem.
Output Cache: The NCache output cache provider is distributed in nature and allows to cache the content of different ASP.NET pages on multiple servers which ensures availability and reliability.
SignalR Backplane: NCache offers support for SignalR by providing extension to the SignalR provider. As soon as a client registers itself against the webserver, NCache fires custom events which cuts down the waiting duration of client to check on updates.
For .NET Framework installation, minimum required version is 4.8
NCache Demonstration Using Sample Application
You can view the sample application for all the features above on GitHub. In this section we will show you how to use the sample application for ASP.NET View State Caching in NCache.
The following steps are same for all of the other features.
Step 1: Download Sample from GitHub
To get started with ASP.NET View State Caching, download the sample application from the GitHub link given above and go to the sample desired.
Step 2: Launch the Project
Launch the ASP.NET View State Caching sample application in Microsoft Visual Studio 2019 or above by clicking on ViewState.sln.
Step 3: Configure Settings
Once you have launched the project, locate and open web.Config from the solutions explorer to your right. Change the
CacheName property of the
cacheSettings tag to the cache which you created in the previous step.
Step 4: Build and Use Sample
Once the application settings have been configured, build the application. Once the application has been built successfully, the application will start running inside a new window on your web browser. You will be able to test the application there.