WalFlow.Stores.Memory 0.1.0-alpha.alpha.20260708090623

This is a prerelease version of WalFlow.Stores.Memory.
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
                    
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="WalFlow.Stores.Memory" Version="0.1.0-alpha.alpha.20260708090623" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WalFlow.Stores.Memory" Version="0.1.0-alpha.alpha.20260708090623" />
                    
Directory.Packages.props
<PackageReference Include="WalFlow.Stores.Memory" />
                    
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 WalFlow.Stores.Memory --version 0.1.0-alpha.alpha.20260708090623
                    
#r "nuget: WalFlow.Stores.Memory, 0.1.0-alpha.alpha.20260708090623"
                    
#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 WalFlow.Stores.Memory@0.1.0-alpha.alpha.20260708090623
                    
#: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=WalFlow.Stores.Memory&version=0.1.0-alpha.alpha.20260708090623&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=WalFlow.Stores.Memory&version=0.1.0-alpha.alpha.20260708090623&prerelease
                    
Install as a Cake Tool

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() and Count properties 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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