migrate-stackexchange
Migrating from StackExchange.Redis to Valkey GLIDE (C#)
Use when migrating a .NET application from StackExchange.Redis to the GLIDE client library.
Status: The GLIDE C# client is in preview (requires .NET 8.0+). APIs may change before GA.
Routing
- String, hash, list, set, sorted set, delete, exists, cluster -> API Mapping
- Transaction, Batch API, fire-and-forget -> Advanced Patterns
- PubSub, subscribe, publish -> Advanced Patterns
- Key types, API compatibility, ecosystem -> Advanced Patterns
Key Differences
| Area | StackExchange.Redis | GLIDE |
|---|---|---|
| Connection | ConnectionMultiplexer.Connect() |
GlideClient.CreateClient(config) |
| Operations | IDatabase methods |
Direct client methods |
| Async model | async/await with Task<T> |
async/await with Task<T> (similar) |
| Configuration | Connection string or ConfigurationOptions |
StandaloneClientConfigurationBuilder |
| Fire-and-forget | CommandFlags.FireAndForget |
Not supported - all commands return results |
| Keys/values | RedisKey / RedisValue types |
Strings |
| Transactions | ITransaction with conditions |
Batch API |
| Connection model | Multiplexed | Multiplexed (single connection per node) |
Both libraries use multiplexed connections and async/await.
Quick Start - Connection Setup
StackExchange.Redis:
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
IDatabase db = muxer.GetDatabase();
GLIDE:
var config = new StandaloneClientConfigurationBuilder()
.WithAddress("localhost", 6379).Build();
await using var client = await GlideClient.CreateClient(config);
No IDatabase layer - commands are called directly on the client instance.
Configuration Mapping
| StackExchange.Redis | GLIDE equivalent |
|---|---|
EndPoints.Add(host, port) |
.WithAddress(host, port) |
Password |
.WithCredentials(username, password) |
DefaultDatabase |
.WithDatabaseId(id) |
Ssl = true |
.WithTls(true) |
ConnectTimeout |
.WithRequestTimeout(ms) |
SyncTimeout |
Part of WithRequestTimeout |
AllowAdmin |
Not applicable |
AbortOnConnectFail |
GLIDE always retries - configure via backoff strategy |
Incremental Migration Strategy
No drop-in compatibility layer exists for C#. The GLIDE C# client intentionally mirrors StackExchange.Redis naming to reduce effort. Migration approach:
- Add
Valkey.GlideNuGet package alongsideStackExchange.Redis - Create a service interface abstracting your Redis operations
- Implement the interface with GLIDE, replacing
IDatabasecalls with direct client calls - Replace
RedisKey/RedisValuetypes with plain strings - Remove
CommandFlags.FireAndForgetusage - use batching for throughput - Migrate one service at a time and run integration tests
- Remove
StackExchange.RedisNuGet package once all services are migrated
GLIDE C# is in preview - evaluate feature coverage before committing to production migration.
Reference
| Topic | File |
|---|---|
| Command-by-command API mapping (strings, hashes, lists, sets, sorted sets, delete, exists, cluster) | api-mapping |
| Transactions, Pub/Sub, key types, fire-and-forget, API compatibility | advanced-patterns |
See Also
- valkey-glide-csharp skill - full GLIDE C# API details
- Batching (see valkey-glide skill) - pipeline and transaction patterns
- PubSub (see valkey-glide skill) - subscription patterns and dynamic PubSub
Gotchas
- Preview status. Not production-ready. Check GLIDE C# releases for the latest API surface.
- Separate client types. StackExchange.Redis auto-detects cluster mode. GLIDE requires
GlideClientorGlideClusterClientexplicitly. - No
IDatabaselayer. Commands are on the client directly. NoGetDatabase(n)- set database in configuration. - No
RedisKey/RedisValuewrappers. GLIDE uses plain strings. - No fire-and-forget. All commands are awaitable. Use batching for throughput.
- .NET 8.0+ required. Earlier .NET versions are not supported.
- Platform support. Pre-built native libraries for Linux (x86_64, arm64), macOS, and Windows.
- API stability. Method signatures may change between releases. Pin the dependency version.
- Ecosystem gap. StackExchange.Redis has 597M+ NuGet downloads. Evaluate feature coverage carefully.
More from avifenesh/valkey-skills
valkey
Use when building apps with Valkey - caching, sessions, queues, locks, rate-limiting, leaderboards, counters, pub-sub, streams, scripting. Covers IFEQ/DELIFEQ, hash field TTL, COMMANDLOG. Not for server internals (valkey-dev) or ops (valkey-ops).
5valkey-dev
Use when contributing to the Valkey server - C internals, event loop, commands, data structures, cluster, replication, RDB/AOF, memory, threading, modules, Lua, RESP, tests. Not for app development (valkey) or ops (valkey-ops).
5valkey-ops
Use when deploying, configuring, monitoring, or troubleshooting self-hosted Valkey. Covers Sentinel, cluster, persistence, replication, security, Kubernetes, performance tuning. Not for app development (valkey) or server internals (valkey-dev).
5valkey-ecosystem
Use when evaluating the Valkey ecosystem - client libraries, modules (JSON, Bloom, Search), managed services (AWS, GCP, Aiven), monitoring tools, frameworks (Spring, Django, Rails), Docker/Kubernetes deployment, CI/CD patterns, migration from Redis, and developer tooling.
5glide-mq
Use when building message queues with glide-mq. Covers queue setup, producer/consumer patterns, job scheduling, workflows, batch processing, streaming, and suspend/resume. Not for migrating from BullMQ (migrate-bullmq) or Bee-Queue (migrate-bee).
4valkey-glide
Router for Valkey GLIDE per-language skills. Use when you need to find the right language-specific GLIDE skill or migration skill. Not for GLIDE library internals or contributing to GLIDE source code - use glide-dev instead.
4