WalFlow.Stores.Memory
0.1.0-alpha.alpha.20260708090623
dotnet add package WalFlow.Stores.Memory --version 0.1.0-alpha.alpha.20260708090623
NuGet\Install-Package WalFlow.Stores.Memory -Version 0.1.0-alpha.alpha.20260708090623
<PackageReference Include="WalFlow.Stores.Memory" Version="0.1.0-alpha.alpha.20260708090623" />
<PackageVersion Include="WalFlow.Stores.Memory" Version="0.1.0-alpha.alpha.20260708090623" />
<PackageReference Include="WalFlow.Stores.Memory" />
paket add WalFlow.Stores.Memory --version 0.1.0-alpha.alpha.20260708090623
#r "nuget: WalFlow.Stores.Memory, 0.1.0-alpha.alpha.20260708090623"
#:package WalFlow.Stores.Memory@0.1.0-alpha.alpha.20260708090623
#addin nuget:?package=WalFlow.Stores.Memory&version=0.1.0-alpha.alpha.20260708090623&prerelease
#tool nuget:?package=WalFlow.Stores.Memory&version=0.1.0-alpha.alpha.20260708090623&prerelease
WalFlow.Stores.Memory
In-memory store for WalFlow CDC processor. State is NOT persisted across restarts. Suitable for testing, development, or scenarios where state persistence is not required.
Features
- In-Memory Storage: Fast, zero-dependency storage using
ConcurrentDictionary - Thread-Safe: Safe for concurrent access
- State Cloning: Clones state on save to prevent external modifications
- Testing Utilities: Includes
Clear()andCountproperties for testing - No Persistence: State is lost on restart (by design)
Installation
dotnet add package WalFlow.Stores.Memory
Usage
Basic Registration
services.AddSingleton<IReplicationStore, MemoryStore>();
Complete Example
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using WalFlow.Abstractions;
using WalFlow.Stores.Memory;
var services = new ServiceCollection();
// Add logging
services.AddLogging(builder => builder.AddConsole());
// Register memory store
services.AddSingleton<IReplicationStore, MemoryStore>();
var serviceProvider = services.BuildServiceProvider();
var stateStore = serviceProvider.GetRequiredService<IReplicationStore>();
// Use the store
var state = new ReplicationState { SlotName = "my_slot", LastProcessedLsn = 12345 };
await stateStore.SaveReplicationStateAsync(state);
var loaded = await stateStore.LoadReplicationStateAsync("my_slot");
Console.WriteLine($"Loaded LSN: {loaded?.LastProcessedLsn}");
Direct Instantiation
var logger = loggerFactory.CreateLogger<MemoryStore>();
var stateStore = new MemoryStore(logger);
// Save state
await stateStore.SaveReplicationStateAsync(new ReplicationState
{
SlotName = "test_slot",
LastProcessedLsn = 12345,
MessagesProcessed = 1000
});
// Load state
var state = await stateStore.LoadReplicationStateAsync("test_slot");
Testing Utilities
var memoryStore = serviceProvider.GetRequiredService<IReplicationStore>() as MemoryStore;
// Check how many states are stored
Console.WriteLine($"States stored: {memoryStore.Count}");
// Clear all states (useful between tests)
memoryStore.Clear();
Use Cases
✅ Good For
- Unit and integration testing
- Development and debugging
- Proof-of-concept implementations
- Stateless/ephemeral CDC scenarios
- Load testing (no I/O overhead)
❌ Not Suitable For
- Production deployments (state lost on restart)
- Multi-instance deployments (state not shared)
- Long-running processes (memory growth over time)
- State recovery after crashes
State Isolation
Each MemoryStore instance maintains its own isolated state. If you need shared state across components, register it as a singleton:
// Singleton - shared state across all components
services.AddSingleton<IReplicationStore, MemoryStore>();
// Transient - each component gets its own isolated state (rarely needed)
services.AddTransient<IReplicationStore, MemoryStore>();
Thread Safety
The MemoryStore is thread-safe and uses ConcurrentDictionary internally. Multiple threads can safely call LoadReplicationStateAsync and SaveReplicationStateAsync concurrently.
Memory Considerations
State is stored in memory and will grow over time. For long-running processes with frequent state updates, consider:
- Periodically calling
Clear()for slots that are no longer active - Monitoring memory usage
- Using a persistent store for production
Comparison with Other Stores
| Feature | Memory | File | Postgres | S3 |
|---|---|---|---|---|
| Persistence | ❌ | ✅ | ✅ | ✅ |
| Performance | ⚡ Fast | 🔸 Medium | 🔸 Medium | 🔹 Slow |
| Multi-Instance | ❌ | ❌ | ✅ | ✅ |
| Setup Required | ❌ | ❌ | ✅ | ✅ |
| Testing | ✅ Ideal | ✅ Good | 🔸 OK | 🔹 Complex |
License
See the LICENSE file in the repository root.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- WalFlow.Abstractions (>= 0.1.0-alpha.alpha.20260708090623)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on WalFlow.Stores.Memory:
| Package | Downloads |
|---|---|
|
WalFlow
Meta-package that pulls in the full WalFlow CDC stack for consumers who want the default everything-included setup. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-alpha.alpha... | 105 | 7/8/2026 |
| 0.1.0-alpha.alpha... | 99 | 3/30/2026 |