Feather.Cache
1.0.0
dotnet add package Feather.Cache --version 1.0.0
NuGet\Install-Package Feather.Cache -Version 1.0.0
<PackageReference Include="Feather.Cache" Version="1.0.0" />
<PackageVersion Include="Feather.Cache" Version="1.0.0" />
<PackageReference Include="Feather.Cache" />
paket add Feather.Cache --version 1.0.0
#r "nuget: Feather.Cache, 1.0.0"
#:package Feather.Cache@1.0.0
#addin nuget:?package=Feather.Cache&version=1.0.0
#tool nuget:?package=Feather.Cache&version=1.0.0
<img src="https://github.com/FeatherTools/.github/blob/main/profile/feather-logo-200.png" alt="FeatherTools Logo" width="100" height="100"> Cache
Redis-backed distributed cache library. Wraps StackExchange.Redis and
IDistributedCacheinto a singleRedisConnectionvalue 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).GetDeleteandStringSetoperate on plain Redis Strings and are mutually compatible.- Do not mix
Cache.storewithGetDeleteon the same key — they use different Redis types. - The
RedisConnectionimplementsIDisposable; dispose it on application shutdown.
Release
- Increment version in
Cache.fsproj - Update
CHANGELOG.md - Commit new version and tag it
Development
Requirements
Build
./build.sh build
Tests
./build.sh -t tests
| 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
- Alma.ServiceIdentification (>= 11.0.0 && < 12.0.0)
- Feather.ErrorHandling (>= 2.0.0 && < 3.0.0)
- FSharp.Core (>= 10.1.202 && < 11.0.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 10.0.6 && < 11.0.0)
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 |