Feather.Cache 1.0.0

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

<img src="https://github.com/FeatherTools/.github/blob/main/profile/feather-logo-200.png" alt="FeatherTools Logo" width="100" height="100"> Cache

NuGet NuGet Downloads Checks

Redis-backed distributed cache library. Wraps StackExchange.Redis and IDistributedCache into a single RedisConnection value that supports both standalone Redis and Redis Sentinel (HA).

Install

paket add Feather.Cache

Connection modes

Standalone

Single Redis instance — for local development or when HA is not required.

let connection =
    Redis.connect (RedisConnectionConfiguration.Standalone {
        Instance = Some myInstance  // Alma.ServiceIdentification.Instance
        Port = 6379
    })

Sentinel (HA)

Three Sentinel nodes managing a primary/replica Redis set. The client always writes to and reads from the current primary — failover is transparent.

In Kubernetes, Sentinel pods expose port 26379. Pod DNS names follow the StatefulSet pattern:

let connection =
    Redis.connect (RedisConnectionConfiguration.Sentinel {
        Sentinels = [
            { Instance = Some sentinel0Instance; Port = 26379 }
            { Instance = Some sentinel1Instance; Port = 26379 }
            { Instance = Some sentinel2Instance; Port = 26379 }
        ]
        ServiceName = "sentinelName"  // must match `sentinel monitor <name>` in sentinel.conf
    })

Cache operations

All operations are on IDistributedCache via Cache module, or directly on RedisConnection for atomic ops.

Standard get/set (via Cache module)

open Feather.Cache

// Store with TTL
do! Cache.store connection.Cache (CacheId "my-key") (Some (TimeSpan.FromMinutes 10.0)) "my-value"

// Store without expiry
do! Cache.store connection.Cache (CacheId "my-key") None "my-value"

// Retrieve
let! value = Cache.tryGet connection.Cache (CacheId "my-key")
// value : string option

Atomic get-and-delete

Use when a value should be consumed exactly once (e.g. one-time tokens).

let! value = connection.GetDelete (CacheId "one-time-token")
// value : string option — atomically removed from Redis

Raw string set

Stores a plain Redis String (not a Hash), required when the value must also be read by GetDelete.

do! connection.StringSet (CacheId "my-key") (Some (TimeSpan.FromHours 1.0)) "raw-value"

Notes

  • IDistributedCache (Cache.store / Cache.tryGet) writes Redis Hashes internally (StackExchange.Redis behaviour).
  • GetDelete and StringSet operate on plain Redis Strings and are mutually compatible.
  • Do not mix Cache.store with GetDelete on the same key — they use different Redis types.
  • The RedisConnection implements IDisposable; dispose it on application shutdown.

Release

  1. Increment version in Cache.fsproj
  2. Update CHANGELOG.md
  3. Commit new version and tag it

Development

Requirements

Build

./build.sh build

Tests

./build.sh -t tests
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

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
1.0.0 158 4/21/2026