AspNetCore.ResponseCache.NCache
5.3.7
dotnet add package AspNetCore.ResponseCache.NCache --version 5.3.7
NuGet\Install-Package AspNetCore.ResponseCache.NCache -Version 5.3.7
<PackageReference Include="AspNetCore.ResponseCache.NCache" Version="5.3.7" />
<PackageVersion Include="AspNetCore.ResponseCache.NCache" Version="5.3.7" />
<PackageReference Include="AspNetCore.ResponseCache.NCache" />
paket add AspNetCore.ResponseCache.NCache --version 5.3.7
#r "nuget: AspNetCore.ResponseCache.NCache, 5.3.7"
#:package AspNetCore.ResponseCache.NCache@5.3.7
#addin nuget:?package=AspNetCore.ResponseCache.NCache&version=5.3.7
#tool nuget:?package=AspNetCore.ResponseCache.NCache&version=5.3.7
AspNetCore.ResponseCache.NCache
This package provides assemblies for using NCache as a distributed response caching provider. It lets MVC view/action output (HTML) be stored in NCache instead of an in-memory response cache, reducing database load and improving performance in multi-server environments. It also supports SQL Server dependency notifications (SqlDependency), so a cached response tied to a specific table is automatically invalidated when the underlying data changes.
Installation
Install-Package AspNetCore.ResponseCache.NCache
or, using the .NET CLI:
dotnet add package AspNetCore.ResponseCache.NCache
What is Installed
Installing this package adds the following NCache configuration files to your project:
- client.ncconf — Contains information about the cache servers of each cache the application needs to access.
- config.ncconf — Used for local inproc cache and inproc client caches. For a client cache, this file must also contain the name of the clustered cache that the client cache is a part of.
- tls.ncconf — Contains TLS/SSL settings used to secure communication between the client and the NCache cluster, if enabled.
NCache tries to read cache information from these local config files first. If the required information isn't found locally, it falls back to the configs inside the NCache installation directory. If NCache is not installed on the machine running the application, make sure all required information is present in the local configs.
Prerequisites
- ASP.NET Core application on .NET 6.0+
- NCache SDK 5.3.7.1 or later.
- An NCache server up and running, with the target cache already created/registered on it.
- SQL Server with Service Broker enabled — only required if
EnableSqlDependencyis turned on for automatic cache invalidation.(Optional)
Getting Started
Setting up NCache
Update client.ncconf so the client knows which cache to connect to and where to find it:
- Open
client.ncconf. - Locate the cache entry named
demoCacheand rename it to the name of your actual cache (the cache you created/registered on the NCache server). - Under the
serversettings, update the server address to point to one of the nodes in the cluster where that cache is running.
Setting up Package
Register NCache response caching in Program.cs:
using Alachisoft.NCache.ResponseCaching;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
// Bind NCache-specific settings from appsettings.json
builder.Services.AddOptions()
.Configure<NCacheConfiguration>(builder.Configuration.GetSection("NCacheSettings"));
// Register NCache as the response caching provider
builder.Services.AddNCacheResponseCachingServices();
var app = builder.Build();
// ... standard middleware (UseHttpsRedirection, UseStaticFiles, UseRouting, UseAuthorization, etc.)
app.Run();
Configuration
ASP.NET Core (appsettings.json):
{
"NCacheSettings": {
"CacheName": "demoCache",
"DefaultConnectionStringName": "DemoDBServer",
"EnableSqlDependency": true,
"SqlDependencySettings": {
"DatabaseName": "Northwind",
"TableName": "dbo.Products"
}
},
"ConnectionStrings": {
"DemoDBServer": "Server=<host>,1433;Database=<database-name>;User Id=<user>;Password=<password>;TrustServerCertificate=True;"
}
}
- CacheName — the NCache cache to use for storing responses.
- DefaultConnectionStringName — must match a key under
ConnectionStrings; used for the SQL dependency connection. - EnableSqlDependency — turn on/off automatic invalidation via SQL Server query notifications.
- SqlDependencySettings — scopes the dependency to a specific
DatabaseName/TableName; when a row in that table changes, cached responses built from it are invalidated.
Resources
Technical Support
Alachisoft provides various technical support resources. Visit the Alachisoft Support Center to select a support resource appropriate for your issue. To request additional features or report a documentation discrepancy, contact support@alachisoft.com.
License
Copyright © 2026 Alachisoft. All rights reserved.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Alachisoft.NCache.SDK (>= 5.3.7.2)
- Microsoft.AspNetCore.DataProtection.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.Http.Features (>= 2.3.0)
- Microsoft.AspNetCore.Session (>= 2.3.0)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Configuration (>= 2.1.0)
- Microsoft.Extensions.Configuration.Json (>= 2.1.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 2.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.