Veggerby.Ignition.Memcached 0.6.0

dotnet add package Veggerby.Ignition.Memcached --version 0.6.0
                    
NuGet\Install-Package Veggerby.Ignition.Memcached -Version 0.6.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="Veggerby.Ignition.Memcached" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Veggerby.Ignition.Memcached" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Veggerby.Ignition.Memcached" />
                    
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 Veggerby.Ignition.Memcached --version 0.6.0
                    
#r "nuget: Veggerby.Ignition.Memcached, 0.6.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 Veggerby.Ignition.Memcached@0.6.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=Veggerby.Ignition.Memcached&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Veggerby.Ignition.Memcached&version=0.6.0
                    
Install as a Cake Tool

Veggerby.Ignition.Memcached

Memcached readiness signals for Veggerby.Ignition - verify cache connections and operations during application startup.

Installation

dotnet add package Veggerby.Ignition.Memcached

Features

  • Multiple Verification Strategies:

    • ConnectionOnly - Fast connection establishment check (default)
    • Stats - Connection + stats command verification
    • TestKey - Full read/write verification with test key round-trip
  • Flexible Configuration:

    • Use existing IMemcachedClient from DI or provide server endpoints
    • Configurable per-signal timeout
    • Customizable test key prefix
    • Automatic cleanup of test keys (60s expiration + explicit delete)
  • Production Ready:

    • Thread-safe and idempotent execution
    • Structured logging with diagnostic details
    • Activity tracing support
    • Works with all coordinator policies and execution modes

Quick Start

Basic Usage (Server Endpoints)

using Veggerby.Ignition.Memcached;

builder.Services.AddIgnition();
builder.Services.AddMemcachedReadiness(new[] { "localhost:11211" });

var app = builder.Build();
await app.Services.GetRequiredService<IIgnitionCoordinator>().WaitAllAsync();

With Verification Strategy

builder.Services.AddMemcachedReadiness(new[] { "localhost:11211" }, options =>
{
    options.VerificationStrategy = MemcachedVerificationStrategy.TestKey;
    options.TestKeyPrefix = "myapp:readiness:";
    options.Timeout = TimeSpan.FromSeconds(5);
});

Using Existing Memcached Client

// Register Memcached client with custom configuration
builder.Services.AddEnyimMemcached(options =>
{
    options.AddServer("server1:11211");
    options.AddServer("server2:11211");
    options.Protocol = MemcachedProtocol.Binary;
});

// Use the registered client
builder.Services.AddMemcachedReadiness(options =>
{
    options.VerificationStrategy = MemcachedVerificationStrategy.Stats;
});

Verification Strategies

ConnectionOnly (Default)

Fastest option - only verifies that the Memcached client is initialized.

builder.Services.AddMemcachedReadiness(new[] { "localhost:11211" }, options =>
{
    options.VerificationStrategy = MemcachedVerificationStrategy.ConnectionOnly;
});

Use when: You trust the client initialization and want minimal startup overhead.

Stats

Executes a stats command to verify server responsiveness.

builder.Services.AddMemcachedReadiness(new[] { "localhost:11211" }, options =>
{
    options.VerificationStrategy = MemcachedVerificationStrategy.Stats;
});

Use when: You want to verify server responsiveness with minimal overhead.

TestKey (Most Thorough)

Performs a full set/get/delete round-trip with a test key.

builder.Services.AddMemcachedReadiness(new[] { "localhost:11211" }, options =>
{
    options.VerificationStrategy = MemcachedVerificationStrategy.TestKey;
    options.TestKeyPrefix = "ignition:readiness:";
});

Use when: You need to verify full read/write capability before starting.

Test Key Behavior:

  • Keys use format: {TestKeyPrefix}{Guid}
  • Set with 60-second expiration
  • Explicitly deleted after verification
  • No cache pollution

Configuration Options

public sealed class MemcachedReadinessOptions
{
    /// <summary>
    /// Per-signal timeout. Null uses global timeout.
    /// </summary>
    public TimeSpan? Timeout { get; set; }

    /// <summary>
    /// Verification strategy (default: ConnectionOnly).
    /// </summary>
    public MemcachedVerificationStrategy VerificationStrategy { get; set; }

    /// <summary>
    /// Prefix for test keys (default: "ignition:readiness:").
    /// </summary>
    public string TestKeyPrefix { get; set; }
}

Integration with Coordinator

Works seamlessly with all ignition features:

builder.Services.AddIgnition(options =>
{
    options.GlobalTimeout = TimeSpan.FromSeconds(30);
    options.Policy = IgnitionPolicy.BestEffort;
    options.ExecutionMode = IgnitionExecutionMode.Parallel;
});

builder.Services.AddMemcachedReadiness(new[] { "localhost:11211" }, options =>
{
    options.VerificationStrategy = MemcachedVerificationStrategy.Stats;
    options.Timeout = TimeSpan.FromSeconds(5); // Per-signal override
});

var result = await coordinator.WaitAllAsync();
// Check result.SignalResults for Memcached status

Multiple Servers

Easily configure multiple Memcached servers:

builder.Services.AddMemcachedReadiness(
    new[] { "cache1:11211", "cache2:11211", "cache3:11211" },
    options =>
    {
        options.VerificationStrategy = MemcachedVerificationStrategy.Stats;
    });

Logging and Tracing

Structured logging output:

[Information] Memcached readiness check starting using strategy Stats
[Debug] Memcached client initialized
[Debug] Executing Memcached stats command
[Debug] Memcached stats retrieved successfully
[Information] Memcached readiness check completed successfully

Activity tags when tracing is enabled:

  • memcached.verification_strategy - Strategy used

Error Handling

Exceptions are properly categorized:

  • Connection failures: InvalidOperationException, client-specific exceptions
  • Timeout: OperationCanceledException (when timeout configured)
  • Verification failures: InvalidOperationException with descriptive message

All exceptions are logged and surfaced through the coordinator's aggregated result.

See Also

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 101 2/2/2026
0.5.1-prerelease0023 89 2/2/2026
0.5.1-prerelease0022 90 1/26/2026
0.5.1-prerelease0021 90 1/22/2026
0.5.1-prerelease0020 90 1/22/2026
0.5.1-prerelease0019 87 1/21/2026
0.5.1-prerelease0018 91 1/21/2026
0.5.1-prerelease0017 92 1/20/2026
0.5.1-prerelease0016 86 1/20/2026
0.5.1-prerelease0014 88 1/20/2026
0.5.1-prerelease0013 91 1/20/2026
0.5.1-prerelease0011 86 1/19/2026
0.5.1-prerelease0009 91 1/19/2026
0.5.1-prerelease0008 96 1/17/2026
0.5.1-prerelease0007 90 1/16/2026
0.5.1-prerelease0006 91 1/16/2026
0.5.1-prerelease0004 94 1/16/2026
0.5.1-prerelease0003 89 1/15/2026
0.5.1-prerelease0002 89 1/15/2026
0.5.1-prerelease0001 95 1/15/2026
Loading failed