Tyto.Rpc.Caching
0.0.1-alpha.95
This is a prerelease version of Tyto.Rpc.Caching.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Tyto.Rpc.Caching --version 0.0.1-alpha.95
NuGet\Install-Package Tyto.Rpc.Caching -Version 0.0.1-alpha.95
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="Tyto.Rpc.Caching" Version="0.0.1-alpha.95" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tyto.Rpc.Caching" Version="0.0.1-alpha.95" />
<PackageReference Include="Tyto.Rpc.Caching" />
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 Tyto.Rpc.Caching --version 0.0.1-alpha.95
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Tyto.Rpc.Caching, 0.0.1-alpha.95"
#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 Tyto.Rpc.Caching@0.0.1-alpha.95
#: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=Tyto.Rpc.Caching&version=0.0.1-alpha.95&prerelease
#tool nuget:?package=Tyto.Rpc.Caching&version=0.0.1-alpha.95&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Tyto.Rpc.Caching
A high-performance, transparent client-side caching decorator for Tyto RPC. It seamlessly integrates Tyto.Rpc with Tyto.Caching without polluting message contracts.
🌟 Key Architectural Principles
- Zero Contract Pollution: Request DTOs (
IRpcRequest<TResponse>) remain 100% pure contracts. No infrastructure interfaces (ICacheable), annotations, or key generators are enforced on models. - Transparent Decorator: Decorates
IRpcClientunder the hood. Uncached requests execute with zero allocation and zero overhead. - L1 Fast-Path Bypass: Utilizes synchronous in-memory L1 cache (
TryGet) before allocating async state machines or distributed locks. - Thundering Herd / Stampede Protection: Leverages
Tyto.Cachinglocking to ensure concurrent identical requests execute only one remote RPC call while safely propagating transient failures. - Full Expiration Support: Hard absolute expiration (TTL), sliding expiration, Stale-While-Revalidate (SWR), and negative caching.
📦 Installation & Setup
Register distributed caching and configure your RPC client:
// 1. Configure Caching Profiles
services.AddDistributedCaching(caching => {
caching.AddProfile<string, CategoryDto>("CatalogProfile", options => {
options.DefaultAbsoluteExpiration = TimeSpan.FromMinutes(30);
});
});
// 2. Configure RPC Client with Caching Policies
services.AddRpc(rpc => {
rpc.AddClient(client => {
client.UseHttp(http => {
http.ConnectTo("CatalogService", new Uri("https://api.catalog.local"))
.Handles<GetCategoryByIdRequest>();
})
.UseCaching(caching => {
// Grouped policy registrations
caching.For<GetCategoryByIdRequest, CategoryDto>(policy => {
policy.WithKey(req => $"category:{req.CategoryId}")
.WithProfile("CatalogProfile")
.WithTtl(TimeSpan.FromMinutes(15))
.WithStaleWhileRevalidate(TimeSpan.FromMinutes(2))
.OnlyIf(req => !req.BypassCache);
});
});
});
});
⚡ Shorthand Single-Request Configuration
For simple setups with single endpoints:
client.UseCaching<GetCategoryByIdRequest, CategoryDto>(policy => {
policy.WithKey(req => $"category:{req.CategoryId}")
.WithTtl(TimeSpan.FromMinutes(10));
});
🚀 Usage in Application Code
The consumer code remains completely unaware of caching:
public class CategoryService(IRpcClient rpcClient) {
public async Task<CategoryDto?> GetAsync(int id, CancellationToken ct) {
// 1st Call -> Executes HTTP/gRPC remote call & populates L1/L2 cache.
// Subsequent Calls -> Served instantly from L1/L2 cache!
RpcResult<CategoryDto> result = await rpcClient.CallAsync(new GetCategoryByIdRequest(id), ct);
return result.Value;
}
}
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Tyto.Caching.Abstractions (>= 0.0.1-alpha.95)
- Tyto.Rpc.Abstractions (>= 0.0.1-alpha.95)
- Tyto.Rpc.Client (>= 0.0.1-alpha.95)
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.1.0-alpha.15 | 52 | 11/30/2026 |
| 0.1.0-alpha.14 | 58 | 11/29/2026 |
| 0.1.0-alpha.13 | 59 | 11/29/2026 |
| 0.1.0-alpha.12 | 68 | 11/27/2026 |
| 0.1.0-alpha.11 | 73 | 10/5/2026 |
| 0.1.0-alpha.10 | 98 | 10/1/2026 |
| 0.1.0-alpha.9 | 81 | 9/27/2026 |
| 0.1.0-alpha.8 | 78 | 9/26/2026 |
| 0.1.0-alpha.7 | 112 | 9/25/2026 |
| 0.1.0-alpha.6 | 84 | 9/24/2026 |
| 0.1.0-alpha.5 | 134 | 9/21/2026 |
| 0.1.0-alpha.4 | 97 | 9/20/2026 |
| 0.1.0-alpha.3 | 94 | 9/20/2026 |
| 0.1.0-alpha.2 | 82 | 9/20/2026 |
| 0.1.0-alpha.1 | 79 | 9/20/2026 |
| 0.0.1-alpha.106 | 78 | 9/15/2026 |
| 0.0.1-alpha.105 | 320 | 9/14/2026 |
| 0.0.1-alpha.104 | 387 | 9/10/2026 |
| 0.0.1-alpha.103 | 91 | 9/4/2026 |
| 0.0.1-alpha.95 | 91 | 8/17/2026 |
Loading failed