A compatibility layer that enables .NET applications to use NCache as a drop-in replacement for Redis with the familiar StackExchange.Redis API.
| Package | Version |
|---|---|
| NCache.StackExchange.Redis | 5.3.6.2 |
| Alachisoft.NCache.SDK | >= 5.3.6.2 |
| Supported StackExchange.Redis | >= 2.12.14 |
Install the package using the .NET CLI:
dotnet add package NCache.OSS.StackExchange.Redis.Wrapper --version 5.3.6.2Or install it using the Package Manager Console:
Install-Package NCache.OSS.StackExchange.Redis.Wrapper -Version 5.3.6.2NCache is an extremely fast and scalable distributed cache for .NET applications. This wrapper allows you to migrate from Redis to NCache with minimal code changes by providing implementations of the StackExchange.Redis interfaces.
Key Benefits:
- Migrate from Redis to NCache without rewriting your application
- Use familiar StackExchange.Redis API patterns
- Leverage NCache's enterprise features (clustering, replication, persistence)
- Maintain existing Redis-based code while gaining NCache performance
Before using this package, ensure you have:
An NCache cache – created and running on the cluster.
The wrapper resolves which NCache cache to connect to from a single identifier, typically read from your app's configuration:
<appSettings>
<add key="CacheId" value="democache" />
</appSettings>using Alachisoft.NCache.Client;
using NCache.OSS.StackExchange.Redis;
using System.Configuration;
string cacheName = ConfigurationManager.AppSettings["CacheId"];
ConnectionMultiplexer mux = ConnectionMultiplexer.Connect(cacheName);
INCacheDatabase db = mux.GetDatabase();mux and db behave like a standard StackExchange.Redis ConnectionMultiplexer/IDatabase pair, so existing Redis call sites — string get/set, key expiration and TTL, bulk operations, pub/sub, locks, and so on — work against db unchanged.
ICache cache = mux.GetNCacheInterface(cacheName);GetNCacheInterface hands back the underlying NCache ICache, useful for operations outside the Redis surface for NCache-only capabilities.
using Microsoft.Extensions.Logging;
ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
{
builder
.AddConsole()
.SetMinimumLevel(LogLevel.Debug);
});The application acts as a test suite, targeting all APIs defined within the wrapper. Simply plug in your cache and run Program.cs.
Copyright © 2005-2026 Alachisoft. All rights reserved.