Table of Contents

NullNotableDateCache Class

Definition

Namespace
Bodu.Globalization.Calendar.Caching
Assembly
Bodu.Globalization.Calendar.Caching.dll
Package
Bodu.Globalization.Calendar.Caching 1.0.0
Source
NullNotableDateCache.cs

An INotableDateCache that stores nothing, used when caching is disabled.

public sealed class NullNotableDateCache : INotableDateCache
Inheritance
NullNotableDateCache
Implements
Inherited Members
Extension Methods

Properties

Instance

Gets the shared no-op cache instance.

public static NullNotableDateCache Instance { get; }

Property Value

NullNotableDateCache

A cache that stores nothing.

Methods

Clear()

Removes every cached entry, returning the cache to its empty state.

public void Clear()

Remarks

This is a best-effort operation: a backing-store failure is swallowed rather than thrown, consistent with the rest of the contract.

GetYear(string, int, string, TimeSpan, DateTimeOffset)

Returns the cached entry for the requested territory, civil year, and resource version when one is present and still fresh, evaluated against asOf.

public NotableDateCacheEntry? GetYear(string territory, int year, string resourceVersion, TimeSpan ttl, DateTimeOffset asOf)

Parameters

territory string

The requested territory code.

year int

The civil year.

resourceVersion string

The version token of the resource currently in effect.

ttl TimeSpan

The duration a computed year remains fresh after it was computed.

asOf DateTimeOffset

The instant against which freshness is evaluated.

Returns

NotableDateCacheEntry

The fresh, version-matching cached entry, or null when none is available, fresh, or version-matching.

Exceptions

ArgumentNullException

Thrown when territory or resourceVersion is null.

StoreYear(NotableDateCacheEntry, TimeSpan, DateTimeOffset)

Stores a computed year, merging it into the territory's cached entries so the most recently computed entry wins per year, and pruning entries that are stale or belong to a superseded resource version.

public NotableDateCacheWriteStatus StoreYear(NotableDateCacheEntry entry, TimeSpan ttl, DateTimeOffset asOf)

Parameters

entry NotableDateCacheEntry

The computed year to store.

ttl TimeSpan

The duration a computed year remains fresh after it was computed.

asOf DateTimeOffset

The instant against which stale entries are pruned.

Returns

NotableDateCacheWriteStatus

Stored when the entry was persisted; Failed when a storage error was swallowed and nothing was persisted; Skipped for a cache that intentionally stores nothing.

Exceptions

ArgumentNullException

Thrown when entry is null.

Applies to

ProductVersions
.NET8, 10