NRedisStack 1.9.0

dotnet add package NRedisStack --version 1.9.0
                    
NuGet\Install-Package NRedisStack -Version 1.9.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NRedisStack" Version="1.9.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NRedisStack" Version="1.9.0" />
                    
Directory.Packages.props
<PackageReference Include="NRedisStack" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NRedisStack --version 1.9.0
                    
#r "nuget: NRedisStack, 1.9.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NRedisStack@1.9.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NRedisStack&version=1.9.0
                    
Install as a Cake Addin
#tool nuget:?package=NRedisStack&version=1.9.0
                    
Install as a Cake Tool

license .github/workflows/integration.yml codecov NRedisStack NuGet release

NRedisStack

NRedisStack is the .NET client for the Redis module commands: Search, JSON, TimeSeries, Bloom filter, Cuckoo filter, T-Digest, Count-min Sketch and Top-K. It builds on StackExchange.Redis, which provides the connection and the core Redis commands; NRedisStack adds the module commands on top. It is developed and maintained by Redis Inc.

Installation

dotnet add package NRedisStack

This also brings in StackExchange.Redis. You need a Redis server that has the modules; Redis 8 includes them:

docker run -p 6379:6379 --name redis redis:latest

Quick start

Connecting is StackExchange.Redis' job, so every kind of connection it supports works here, and the module commands hang off the IDatabase it gives you.

Standalone

using NRedisStack;
using NRedisStack.RedisStackCommands;
using StackExchange.Redis;

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
IDatabase db = redis.GetDatabase();

JsonCommands json = db.JSON();
json.Set("user:1", "$", new { Age = 35, Name = "Alice" });

Each module has an accessor:

BloomCommands bf = db.BF();
CuckooCommands cf = db.CF();
CmsCommands cms = db.CMS();
TopKCommands topk = db.TOPK();
TdigestCommands tdigest = db.TDIGEST();
SearchCommands ft = db.FT();
JsonCommands json = db.JSON();
TimeSeriesCommands ts = db.TS();

Every command has an async twin on the same object, for example await json.SetAsync(...). Core Redis commands are used exactly as in StackExchange.Redis, for example db.StringSet("key", "value").

Cluster

List one or more cluster nodes; the rest are discovered, and commands are routed by key:

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("127.0.0.1:16379,127.0.0.1:16380");
IDatabase db = redis.GetDatabase();
SearchCommands ft = db.FT();

Sentinel

Name the sentinel endpoints and the service; the connection follows the current primary:

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost:26379,serviceName=mymaster");
IDatabase db = redis.GetDatabase();

Pub/sub

NRedisStack adds nothing to pub/sub. Use the StackExchange.Redis subscriber on the same multiplexer:

ISubscriber sub = redis.GetSubscriber();
sub.Subscribe(RedisChannel.Literal("news"), (channel, message) => Console.WriteLine(message));

Pipelines and transactions

Pipeline and Transaction expose the async module commands over a StackExchange.Redis batch or transaction:

var pipeline = new Pipeline(db);
_ = pipeline.Json.SetAsync("user:2", "$", new { Age = 28, Name = "Bob" });
_ = pipeline.Json.SetAsync("user:3", "$", new { Age = 41, Name = "Carol" });
pipeline.Execute();

To search for documents, create an index and run a query:

using NRedisStack.Search;
using NRedisStack.Search.Literals.Enums;

SearchCommands ft = db.FT();

// FT.CREATE myIndex ON HASH PREFIX 1 doc: SCHEMA title TEXT WEIGHT 5.0 body TEXT url TEXT
ft.Create("myIndex", new FTCreateParams().On(IndexDataType.HASH)
                                         .Prefix("doc:"),
                     new Schema().AddTextField("title", 5.0)
                                 .AddTextField("body")
                                 .AddTextField("url"));

// Documents with the doc: prefix are indexed automatically when created or modified.
// HSET doc:1 title "hello world" body "lorem ipsum" url "http://redis.io"
db.HashSet("doc:1", new HashEntry[] { new("title", "hello world"),
                                      new("body", "lorem ipsum"),
                                      new("url", "http://redis.io") });

// FT.SEARCH myIndex "hello world" LIMIT 0 10
ft.Search("myIndex", new Query("hello world").Limit(0, 10));

// FT.DROPINDEX myIndex
ft.DropIndex("myIndex");

Search dialect

By default the client sends DIALECT 2 with commands such as FT.SEARCH and FT.AGGREGATE, overriding the server-side default dialect. The dialect can change the results a query returns. To use a different one, pass it to the accessor, for example db.FT(3).

More examples

The Examples folder has longer walk-throughs: JSON, query operations, pipelines, transactions and combining modules.

Documentation

New to Redis? Redis University is free, the developer tutorials cover common use cases, and Redis Cloud has a free tier.

Getting help and contributing

Supported versions

  • Redis. Each release is tested against the Redis versions in the CI matrix: the current stable release and the long-term-support releases on every pull request, and a wider set nightly. A command that an older server does not have fails with that server's error.
  • .NET. The package targets .NET Standard 2.0, so it runs on .NET Framework and on every modern .NET. It also has builds for the .NET versions listed in NRedisStack.csproj.

License

NRedisStack is released under the MIT license.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 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 is compatible.  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 is compatible. 
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (65)

Showing the top 5 NuGet packages that depend on NRedisStack:

Package Downloads
Microsoft.SemanticKernel.Connectors.Redis

Redis provider for Microsoft.Extensions.VectorData by Semantic Kernel

Microsoft.KernelMemory.MemoryDb.Redis

Redis connector for Microsoft Kernel Memory, to store and search memory using Redis vector search and other Redis features.

CTT.Dotnet.Toolkit

Package Description

ShayganTadbir.Framework.Core

Package description

FCMicroservices

a boilerplate microservice framework

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on NRedisStack:

Repository Stars
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
dluc/kernel-memory
Research project. A Memory solution for users, teams, and applications.
microsoft/Document-Knowledge-Mining-Solution-Accelerator
Solution accelerator built on Azure OpenAI Service and Azure AI Document Intelligence to process and extract summaries, entities, and metadata from unstructured, multi-modal documents and enable searching and chatting over this data.
Version Downloads Last Updated
1.9.0 1,025 12/3/2026
1.8.0 188,735 9/18/2026
1.7.4 72,280 8/24/2026
1.7.3 102,937 8/3/2026
1.7.2 6,060 7/31/2026
1.7.1 3,792 7/30/2026
1.6.0 141,813 6/17/2026
1.5.0 191,607 5/27/2026
1.4.0 89,262 5/11/2026
1.3.0 528,826 2/10/2026
1.2.0 126,951 1/15/2026
1.1.1 804,637 9/17/2025
1.1.0 352,755 8/5/2025
1.0.0 3,195,916 4/30/2025
1.0.0-beta1 25,954 3/24/2025
0.13.3 282,875 4/15/2025
0.13.2 547,958 2/7/2025
0.13.1 715,929 11/22/2024
0.13.0 781,229 9/13/2024
Loading failed