Use NCache for ASP.NET Core Applications
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 NCache’s enhanced 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
AddNCache()
method 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.
Note
For .NET Core installation, minimum required version is 3.1
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.
Note
The following steps are 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 the GitHub link given above and go to the sample desired.
Step 2: Launch the Project
Launch the ASP.NET Core Response Caching sample application in Microsoft Visual Studio 2019 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 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.