Bodu.Globalization.Calendar.Caching
0.6.0
See the version list below for details.
dotnet add package Bodu.Globalization.Calendar.Caching --version 0.6.0
NuGet\Install-Package Bodu.Globalization.Calendar.Caching -Version 0.6.0
<PackageReference Include="Bodu.Globalization.Calendar.Caching" Version="0.6.0" />
<PackageVersion Include="Bodu.Globalization.Calendar.Caching" Version="0.6.0" />
<PackageReference Include="Bodu.Globalization.Calendar.Caching" />
paket add Bodu.Globalization.Calendar.Caching --version 0.6.0
#r "nuget: Bodu.Globalization.Calendar.Caching, 0.6.0"
#:package Bodu.Globalization.Calendar.Caching@0.6.0
#addin nuget:?package=Bodu.Globalization.Calendar.Caching&version=0.6.0
#tool nuget:?package=Bodu.Globalization.Calendar.Caching&version=0.6.0
Bodu.Globalization.Calendar.Caching
API stability — Preview. The public API surface is largely settled but is still being finalized ahead of the 1.0 release and may change; breaking changes can land in a minor version until then.
A read-through cache that sits in front of the notable-date service. The engine stays a pure
computer that knows nothing of caching: CachingNotableDateService implements the same
INotableDateService contract, so it drops in transparently wherever the service is consumed.
For the full walkthrough — quickstart, freshness, warm-up, and observability — see the Caching notable dates guide; the per-backend surface is in Backends and options, and Writing a custom backend covers the
INotableDateCachecontract.
Installation
dotnet add package Bodu.Globalization.Calendar.Caching
Targets net8.0. All types live in the Bodu.Globalization.Calendar.Caching namespace.
services.AddCachedNotableDateService(/* … */);
How it caches
- The whole civil year is the cache unit. Every query is answered per Gregorian year: a range is decomposed into the years it spans, each year is served from the cache or recomputed whole, and the result is clipped to the requested window. A later single-day query for a cached year never recomputes.
- Freshness has two independent triggers. A time-to-live expires entries a fixed duration after computation, and a resource-version token invalidates every entry computed under a previous resource — so a data reload always forces a recompute regardless of the time-to-live.
- Concurrent cold misses coalesce. The first caller for a cold (territory, year) computes; concurrent callers join that single flight instead of stampeding the engine.
- Storage is best-effort. The shipped backends degrade gracefully: a failed read is a miss, a failed write is skipped. A broken disk never breaks date resolution.
Backends in this package
| Type | Storage | Notes |
|---|---|---|
InMemoryNotableDateCache |
Process memory | No configuration required; the default for a single process |
TomlNotableDateCache |
One TOML file per territory | Human-readable and diffable on disk |
JsonNotableDateCache |
One JSON file per territory | Same file layout, JSON encoding |
NullNotableDateCache |
Nothing | Always misses; for disabling caching without changing wiring |
Durable and shared backends ship separately:
…Caching.Sqlite and
…Caching.Distributed.
Both file backends derive from FileNotableDateCacheBase / FileNotableDateCacheOptions; a custom
backend implements INotableDateCache (or extends NotableDateCacheBase<TOptions>).
Warm-up
AddNotableDateCacheWarmup registers a hosted NotableDateCacheWarmupService that drives
CachingNotableDateService.Warm over a configurable rolling territory/year window, so the first
real request does not pay the cold-compute cost.
Out of scope
Computing the dates themselves — that is
Bodu.Globalization.Calendar, which
this package decorates. The rules come from the regional data packs
(Bodu.Globalization.Calendar.{Americas,AsiaPacific,Europe,MiddleEast,Africa}).
Part of the Bodu utility library.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Bodu.Core (>= 0.6.0)
- Bodu.Globalization.Calendar (>= 0.6.0)
- Bodu.Text.Toml (>= 0.6.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Bodu.Globalization.Calendar.Caching:
| Package | Downloads |
|---|---|
|
Bodu.Globalization.Calendar.Caching.Sqlite
SQLite storage backend for the Bodu.Globalization.Calendar notable-date cache. Provides SqliteNotableDateCache, an INotableDateCache that persists computed years in a SQLite database, and the AddSqliteNotableDateCache dependency-injection registration. |
|
|
Bodu.Globalization.Calendar.Caching.Distributed
Distributed (IDistributedCache / Redis) storage backend for the Bodu.Globalization.Calendar notable-date cache. Provides DistributedNotableDateCache, an INotableDateCache over any IDistributedCache, and the AddDistributedNotableDateCache / AddRedisNotableDateCache dependency-injection registrations. |
GitHub repositories
This package is not used by any popular GitHub repositories.