AspNetCore.ResponseCache.NCache
5.3.800
dotnet add package AspNetCore.ResponseCache.NCache --version 5.3.800
NuGet\Install-Package AspNetCore.ResponseCache.NCache -Version 5.3.800
<PackageReference Include="AspNetCore.ResponseCache.NCache" Version="5.3.800" />
<PackageVersion Include="AspNetCore.ResponseCache.NCache" Version="5.3.800" />
<PackageReference Include="AspNetCore.ResponseCache.NCache" />
paket add AspNetCore.ResponseCache.NCache --version 5.3.800
#r "nuget: AspNetCore.ResponseCache.NCache, 5.3.800"
#:package AspNetCore.ResponseCache.NCache@5.3.800
#addin nuget:?package=AspNetCore.ResponseCache.NCache&version=5.3.800
#tool nuget:?package=AspNetCore.ResponseCache.NCache&version=5.3.800
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
Prerequisites
- ASP.NET Core application on .NET 8.0+
- 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
- Open your application's configuration file:
- .NET / ASP.NET Core:
appsettings.json
- .NET / ASP.NET Core:
- Add an entry for the cache you created on the NCache server, keyed by the cache's name. The
example uses
defaultCache; replace it with your cache's name. - Set
serverto one or more nodes of the cluster where that cache is running. Separate multiple nodes with commas.
appsettings.json
{
"ncache": {
"defaultCache": {
"server": "20.200.20.24,20.200.20.25",
"port": 9800
}
}
}
The cache name in the configuration must match the name you pass in code:
ICache cache = CacheManager.GetCache("defaultCache");
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": "defaultCache",
"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 | net8.0 is compatible. 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. |
-
net8.0
- Alachisoft.NCache.SDK (>= 5.3.800)
- Microsoft.Extensions.Caching.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- System.Text.Encodings.Web (>= 10.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.