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
territorystringThe requested territory code.
yearintThe civil year.
resourceVersionstringThe version token of the resource currently in effect.
ttlTimeSpanThe duration a computed year remains fresh after it was computed.
asOfDateTimeOffsetThe 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
territoryorresourceVersionis 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
entryNotableDateCacheEntryThe computed year to store.
ttlTimeSpanThe duration a computed year remains fresh after it was computed.
asOfDateTimeOffsetThe 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
entryis null.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |