Bodu.Globalization.Calendar.Caching 0.6.0

There is a newer version of this package available.
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
                    
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="Bodu.Globalization.Calendar.Caching" Version="0.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bodu.Globalization.Calendar.Caching" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Bodu.Globalization.Calendar.Caching" />
                    
Project file
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 Bodu.Globalization.Calendar.Caching --version 0.6.0
                    
#r "nuget: Bodu.Globalization.Calendar.Caching, 0.6.0"
                    
#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 Bodu.Globalization.Calendar.Caching@0.6.0
                    
#: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=Bodu.Globalization.Calendar.Caching&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Bodu.Globalization.Calendar.Caching&version=0.6.0
                    
Install as a Cake Tool

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 INotableDateCache contract.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
1.0.0 50 9/24/2026
0.7.0 93 9/24/2026
0.6.0 70 9/24/2026