Fluens.Caching
0.9.4
dotnet add package Fluens.Caching --version 0.9.4
NuGet\Install-Package Fluens.Caching -Version 0.9.4
<PackageReference Include="Fluens.Caching" Version="0.9.4" />
<PackageVersion Include="Fluens.Caching" Version="0.9.4" />
<PackageReference Include="Fluens.Caching" />
paket add Fluens.Caching --version 0.9.4
#r "nuget: Fluens.Caching, 0.9.4"
#:package Fluens.Caching@0.9.4
#addin nuget:?package=Fluens.Caching&version=0.9.4
#tool nuget:?package=Fluens.Caching&version=0.9.4
Fluens.Caching
HybridCache configuration helper for Fluens builder infrastructure.
Installation
dotnet add package Fluens.Caching
Usage
fluensBuilder.AddCaching(c =>
{
c.Options.DefaultExpirationSeconds = 300; // default: 300 (5 min)
c.Options.DefaultLocalExpirationSeconds = 60; // default: 60 (1 min)
c.Options.MaximumPayloadBytes = 1_048_576; // default: 1 MB
c.Options.MaximumKeyLength = 1024; // default: 1024
});
Configuration section: Fluens:Caching. Consumers inject HybridCache directly. Binding order is
bind, callback, validate - a value set only from the callback (never present in configuration) is
still validated, and it is never silently reverted back to defaults by a later AddCaching(...) call.
Flipping Enabled across repeated calls: A later AddCaching call that sets Enabled to false after an earlier call registered the caching services throws InvalidOperationException naming Fluens:Caching; a later call that sets it to true after a disabled one behaves like the first enabled call - it validates the options and registers HybridCache plus the providers queued in its own callback, while providers queued in the earlier disabled call stay dropped.
CachingBuilder
The optional Action<CachingBuilder> callback exposes:
Options- theCachingOptionsinstance mutated inside the callback; validation runs right after the callback returns, so an invalid value set here throwsOptionsException<CachingOptions>at registration time.Fluens- theIFluensBuildertheAddCachingcall was made on, so a provider package (e.g.Fluens.Caching.Redis) can readApplicationor call back into other Fluens registrations.AddProvider(string providerKey, Func<bool> configure, Action<IServiceCollection> register)- lets a provider package (e.g. Redis) queue its own registrations, applied only onceCachingOptions.Enabledis confirmedtrue.configureruns on every call (it applies the caller's callback to the provider's options, validates them and returns whether the provider is active);registerruns once per host perproviderKey, also across separateAddCachingcalls, and counts only calls whoseconfigurereturnedtrue(an inactive call does not claim the key). A provider should read its option values when they are resolved, not capture them inregister.IsProviderRegistered(providerKey)- reports whether the key is already claimed on this host, also from a laterAddCachingcall's builder.
CachingBuilder deliberately does not expose the raw IServiceCollection - a provider must queue its registration through AddProvider so nothing is registered until AddCaching confirms caching is enabled.
The builder is sealed once its AddCaching call returns, whether caching is enabled or disabled: AddProvider on a builder captured from the callback and called afterwards throws InvalidOperationException instead of being lost. Inside a disabled callback AddProvider is still dropped without an exception.
CachingOptions
| Property | Type | Default | Description |
|---|---|---|---|
Enabled |
bool |
true |
When false, no caching services are registered |
DefaultExpirationSeconds |
int |
300 |
L2 (distributed) cache expiration in seconds |
DefaultLocalExpirationSeconds |
int |
60 |
L1 (in-memory) cache expiration in seconds |
MaximumPayloadBytes |
int |
1048576 |
Maximum serialized size of a cache entry in bytes |
MaximumKeyLength |
int |
1024 |
Maximum length of a cache key |
License
This project is licensed under the MIT License.
| 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
- Fluens (>= 0.9.4)
- Microsoft.Extensions.Caching.Hybrid (>= 10.11.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.13)
- Scrutor (>= 7.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Fluens.Caching:
| Package | Downloads |
|---|---|
|
Fluens.Caching.Redis
Redis distributed cache (L2) configuration for HybridCache via Fluens builder infrastructure. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.9.4 | 219 | 11/30/2026 |
| 0.9.3 | 291 | 11/17/2026 |
| 0.9.2 | 157 | 10/21/2026 |
| 0.9.1 | 478 | 10/13/2026 |
| 0.9.0 | 113 | 10/13/2026 |
| 0.8.7 | 270 | 10/12/2026 |
| 0.8.6 | 129 | 10/12/2026 |
| 0.8.5 | 133 | 10/7/2026 |
| 0.8.4 | 112 | 10/6/2026 |
| 0.8.3 | 124 | 10/6/2026 |
| 0.8.2 | 186 | 10/5/2026 |
| 0.8.1 | 162 | 9/15/2026 |
| 0.8.0 | 122 | 9/15/2026 |
| 0.7.11 | 136 | 9/15/2026 |
| 0.7.10 | 126 | 9/13/2026 |
| 0.7.9 | 126 | 9/11/2026 |
| 0.7.8 | 125 | 9/10/2026 |
| 0.7.7 | 141 | 9/10/2026 |
| 0.7.6 | 193 | 7/1/2026 |
| 0.7.5 | 158 | 6/22/2026 |