NCache for ASP.NET Core Caching
NCache is a very feature-rich and versatile software. It provides support for various features of ASP.NET Core. You can store ASP.NET Core sessions using the enhanced features of NCache. SignalR can be configured and utilized in ASP.NET Core applications using NCache. Response Caching can also be done using NCache.
ASP.NET Core Sessions: NCache has introduced Sessions State Management for ASP.NET Core to provide support with the new architecture. NCache provides flexible options to combine sessions with enhanced NCache caching capabilities, to boost performance as a whole.
SignalR: SignalR allows developers to create real-time ASP.NET Core web applications, where the server broadcasts the updates to all registered clients as soon as an update is triggered. NCache extends the ISignalRServerBuilder method with its
AddNCachemethod which requires just the cache name, event key, and user credentials for the item added.
Response Caching: ASP.NET Core provides response caching which allows you to cache the server response of a client request for future requests.
For .NET installation, the minimum required version is 6.0.
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 Core Response Caching in NCache.
The following steps are the same for all of the other features.
Step 1: Download Sample from GitHub
To get started with ASP.NET Core Response Caching, download the sample application from GitHub and go to the desired sample.
Step 2: Launch the Project
Launch the ASP.NET Core Response Caching sample application in Microsoft Visual Studio 2022 or above by clicking on ResponseCaching.sln.
Step 3: Configure Settings
Once you have launched the project, locate and open appsettings.json from the solutions explorer to your right. Change the
CacheName attribute to the cache which have been created.
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.