ForgeTrust.AppSurface.Caching
0.1.0-rc.3
dotnet add package ForgeTrust.AppSurface.Caching --version 0.1.0-rc.3
NuGet\Install-Package ForgeTrust.AppSurface.Caching -Version 0.1.0-rc.3
<PackageReference Include="ForgeTrust.AppSurface.Caching" Version="0.1.0-rc.3" />
<PackageVersion Include="ForgeTrust.AppSurface.Caching" Version="0.1.0-rc.3" />
<PackageReference Include="ForgeTrust.AppSurface.Caching" />
paket add ForgeTrust.AppSurface.Caching --version 0.1.0-rc.3
#r "nuget: ForgeTrust.AppSurface.Caching, 0.1.0-rc.3"
#:package ForgeTrust.AppSurface.Caching@0.1.0-rc.3
#addin nuget:?package=ForgeTrust.AppSurface.Caching&version=0.1.0-rc.3&prerelease
#tool nuget:?package=ForgeTrust.AppSurface.Caching&version=0.1.0-rc.3&prerelease
ForgeTrust.AppSurface.Caching
Caching primitives for AppSurface applications built on top of Microsoft.Extensions.Caching.Memory.
Overview
This package provides a small, focused caching layer for AppSurface modules. It is designed for scenarios where you want consistent memoization behavior, cache policies, and a module you can register into the AppSurface startup pipeline.
Release Guidance
AppSurface has cut the first coordinated v0.1.0 release candidate. Before installing this package from a prerelease feed, read the v0.1.0 RC 3 release note for current release risk, migration guidance, and package readiness.
Key Types
AppSurfaceCachingModule: Registers the package services into the AppSurface module system.IMemo/Memo: Memoization helpers for caching computed values and async results.CachePolicy: A simple policy object for configuring expiration and cache behavior.
Usage
Register the module in your application and inject IMemo where you want to cache repeated work:
public sealed class MyModule : AppSurfaceCachingModule
{
}
Use memoization for expensive or repeated lookups:
var result = await memo.GetAsync(
() => LoadDocsAsync(),
CachePolicy.Absolute(TimeSpan.FromMinutes(5)));
Use stale-while-revalidate for expensive values that should stay responsive after their freshness window expires:
var result = await memo.GetAsync(
() => LoadDocsAsync(),
CachePolicy.AbsoluteWithStaleWhileRevalidate(
freshDuration: TimeSpan.FromMinutes(5),
staleDuration: TimeSpan.FromMinutes(5)));
Notes
- The package builds on
Microsoft.Extensions.Caching.Memory, so it works well for in-process application caching. CachePolicy.AbsoluteWithStaleWhileRevalidatereturns the stale value immediately during the stale window and starts one background refresh for that cache key. If the background refresh fails, the stale value remains available until the stale window ends.- Stale-while-revalidate is supported for absolute-expiration policies. Sliding expiration does not have a stable revalidation moment, so use
CachePolicy.AbsoluteWithStaleWhileRevalidate(...)orCachePolicy.Absolute(...).WithStaleWhileRevalidate(...). - This package is intentionally lightweight and fits best when you want simple, application-level caching rather than a distributed cache abstraction.
| 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
- CliWrap (>= 3.10.1)
- ForgeTrust.AppSurface.Core (>= 0.1.0-rc.3)
- Microsoft.Extensions.Caching.Memory (>= 10.0.8)
- Microsoft.Extensions.Hosting (>= 10.0.8)
- Microsoft.Extensions.Logging.Console (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ForgeTrust.AppSurface.Caching:
| Package | Downloads |
|---|---|
|
ForgeTrust.AppSurface.Docs
ForgeTrust.AppSurface.Docs package for AppSurface application composition. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-rc.3 | 51 | 6/8/2026 |
| 0.1.0-rc.2 | 54 | 6/3/2026 |
| 0.1.0-rc.1 | 57 | 5/31/2026 |
| 0.1.0-preview.4 | 56 | 5/25/2026 |
| 0.1.0-preview.3 | 61 | 5/20/2026 |
| 0.1.0-preview.2 | 64 | 5/14/2026 |