Valkey General Language Independent Driver for the Enterprise (GLIDE) is the official open-source Valkey client library for C#. Built on a robust Rust core, it provides high-performance, reliable connectivity to Valkey and Redis OSS servers with comprehensive async/await support.
- High Performance: Built with a Rust core for optimal performance and low latency
 - Async/Await Support: Full support for modern C# asynchronous programming patterns
 - Cross-Platform: Supports .NET 6.0+ on Windows, Linux, and macOS
 - Type Safety: Strongly-typed API with comprehensive IntelliSense support
 - Enterprise Ready: Designed for production workloads with robust error handling
 - Community Driven: Open source with active community support
 - API Compatibility: Compatible with StackExchange.Redis APIs to ease migration
 
- AZ Affinity – Ensures low-latency connections and minimal cross-zone costs by routing read traffic to replicas in the client's availability zone. (Requires Valkey server version 8.0+ or AWS ElastiCache for Valkey 7.2+)
 - PubSub Auto-Reconnection – Seamless background resubscription on topology updates or disconnection
 - Sharded PubSub – Native support for sharded PubSub across cluster slots
 - Cluster-Aware MGET/MSET/DEL/FLUSHALL – Execute multi-key commands across cluster slots without manual key grouping
 - Cluster Scan – Unified key iteration across shards using a consistent, high-level API
 - Batching (Pipeline and Transaction) – Execute multiple commands efficiently in a single network roundtrip
 - OpenTelemetry – Integrated tracing support for enhanced observability
 
Important
Valkey.Glide C# wrapper is in a preview state and still has many features that remain to be implemented before GA.
Valkey GLIDE for C# is API-compatible with the following engine versions:
| Engine Type | 6.2 | 7.0 | 7.1 | 7.2 | 8.0 | 8.1 | 
|---|---|---|---|---|---|---|
| Valkey | - | - | - | V | V | V | 
| Redis | V | V | V | V | - | - | 
Install the Valkey GLIDE package from NuGet:
dotnet add package Valkey.GlideOr via Package Manager Console in Visual Studio:
Install-Package Valkey.Glide- .NET 6.0 or higher
 - Supported Platforms: Windows, Linux, macOS
 - Valkey/Redis Server: Version 6.2+ (see compatibility table above)
 
using Valkey.Glide;
// Create a standalone client
var connection = await ConnectionMultiplexer.ConnectAsync("localhost:6379");
var db = connection.Database;
// Basic string operations
await db.StringSetAsync("key", "value");
var result = await db.StringGetAsync("key");
Console.WriteLine($"Retrieved: {result}");using Valkey.Glide;
using static Valkey.Glide.ConnectionConfiguration;
// Create a cluster client
var config = new ClusterClientConfigurationBuilder()
    .WithAddress("cluster-node1.example.com", 6379)
    .WithAddress("cluster-node2.example.com", 6379)
    .WithAddress("cluster-node3.example.com", 6379)
    .Build();
using var client = await GlideClusterClient.CreateClient(config);
// Cluster operations work seamlessly
await client.StringSetAsync("user:1000", "John Doe");
var user = await client.StringGetAsync("user:1000");
Console.WriteLine($"User: {user}");var config = new StandaloneClientConfigurationBuilder()
    .WithAddress("secure-server.example.com", 6380)
    .WithAuthentication("username", "password")
    .WithTls()
    .Build();
using var client = await GlideClient.CreateClient(config);// Set and get strings
await client.StringSetAsync("greeting", "Hello, World!");
var greeting = await client.StringGetAsync("greeting");
// Multiple keys
var keyValuePairs = new KeyValuePair<ValkeyKey, ValkeyValue>[]
{
    new("key1", "value1"),
    new("key2", "value2")
};
await client.StringSetAsync(keyValuePairs);
var values = await client.StringGetAsync(new[] { "key1", "key2" });// Hash operations
await client.HashSetAsync("user:1000", "name", "John Doe");
await client.HashSetAsync("user:1000", "email", "[email protected]");
var name = await client.HashGetAsync("user:1000", "name");
var allFields = await client.HashGetAllAsync("user:1000");// List operations
await client.ListPushAsync("tasks", "task1", ListDirection.Left);
await client.ListPushAsync("tasks", "task2", ListDirection.Left);
var task = await client.ListPopAsync("tasks", ListDirection.Right);
var allTasks = await client.ListRangeAsync("tasks", 0, -1);// Set operations
await client.SetAddAsync("tags", "csharp");
await client.SetAddAsync("tags", "dotnet");
await client.SetAddAsync("tags", "valkey");
var isMember = await client.SetIsMemberAsync("tags", "csharp");
var allTags = await client.SetMembersAsync("tags");Development instructions for local building & testing the package are in the DEVELOPER.md file.
- API Documentation - Complete API reference
 - General Concepts - Core concepts and patterns
 
Valkey GLIDE for C# is built for high performance:
- Rust Core: Leverages Rust's memory safety and performance included multi-threaded support
 - Async/Await: Non-blocking operations for better throughput
 - Connection Pooling: Efficient connection management
 - Pipeline Support: Batch operations for reduced latency
 
try
{
    await client.StringSetAsync("key", "value");
    var result = await client.StringGetAsync("key");
}
catch (ConnectionException ex)
{
    Console.WriteLine($"Connection error: {ex.Message}");
}
catch (TimeoutException ex)
{
    Console.WriteLine($"Operation timed out: {ex.Message}");
}
catch (ValkeyException ex)
{
    Console.WriteLine($"Valkey error: {ex.Message}");
}We welcome contributions! Please see our Contributing Guidelines for details on:
- Setting up the development environment
 - Running tests
 - Submitting pull requests
 - Code style guidelines
 
- GitHub Issues: Report bugs or request features
 - Valkey Slack: Join our community
 - Documentation: Official docs
 
When reporting issues, please include:
- Valkey GLIDE version
 - .NET version and runtime
 - Operating system
 - Server version and configuration
 - Minimal reproducible code
 - Error messages and stack traces
 
This project is licensed under the Apache License 2.0.
Valkey GLIDE for C# integrates well with the .NET ecosystem:
- ASP.NET Core: Use as a caching layer or session store
 - Entity Framework: Complement your ORM with high-performance caching
 - Minimal APIs: Perfect for microservices and API backends
 - Background Services: Ideal for queue processing and background tasks
 
Ready to get started? Install the NuGet package and check out our Quick Start guide!