Table of Contents

NotableDateCacheEntry Class

Definition

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

Represents one cached unit of notable-date resolution: every occurrence emitted within a single civil year for a single territory under a single resource version, together with the UTC instant the year was computed, which drives expiry.

public sealed record NotableDateCacheEntry : IEquatable<NotableDateCacheEntry>
Inheritance
NotableDateCacheEntry
Implements
Inherited Members
Extension Methods

Remarks

A civil year is the natural cache unit because the notable-date engine computes per Gregorian year: resolving one year is a pure function of the resource, the territory, and the year. A range query is assembled from the per-year entries it spans, then clipped to the requested window by each occurrence's emitted date.

An entry with an empty Occurrences list is a valid, cacheable result: it records that the year was computed and yielded no notable dates, so a later query is served rather than recomputed. Freshness is governed both by ComputedAtUtc against a time-to-live and by ResourceVersion against the resource currently in effect.

Constructors

NotableDateCacheEntry(string, int, string, IReadOnlyList<NotableDate>, DateTimeOffset)

Represents one cached unit of notable-date resolution: every occurrence emitted within a single civil year for a single territory under a single resource version, together with the UTC instant the year was computed, which drives expiry.

public NotableDateCacheEntry(string Territory, int Year, string ResourceVersion, IReadOnlyList<NotableDate> Occurrences, DateTimeOffset ComputedAtUtc)

Parameters

Territory string

The normalized territory the occurrences were resolved for.

Year int

The civil year the occurrences were emitted within.

ResourceVersion string

The version token of the resource the occurrences were computed from; a change invalidates the entry.

Occurrences IReadOnlyList<NotableDate>

The occurrences emitted within Year, unfiltered and in the order they were computed (the notable-date service's date-then-identity order), which backends preserve per the INotableDateCache ordering contract.

ComputedAtUtc DateTimeOffset

The UTC instant at which the year was computed and written to the cache.

Remarks

A civil year is the natural cache unit because the notable-date engine computes per Gregorian year: resolving one year is a pure function of the resource, the territory, and the year. A range query is assembled from the per-year entries it spans, then clipped to the requested window by each occurrence's emitted date.

An entry with an empty Occurrences list is a valid, cacheable result: it records that the year was computed and yielded no notable dates, so a later query is served rather than recomputed. Freshness is governed both by ComputedAtUtc against a time-to-live and by ResourceVersion against the resource currently in effect.

Properties

ComputedAtUtc

The UTC instant at which the year was computed and written to the cache.

public DateTimeOffset ComputedAtUtc { get; init; }

Property Value

DateTimeOffset

Occurrences

The occurrences emitted within Year, unfiltered and in the order they were computed (the notable-date service's date-then-identity order), which backends preserve per the INotableDateCache ordering contract.

public IReadOnlyList<NotableDate> Occurrences { get; init; }

Property Value

IReadOnlyList<NotableDate>

ResourceVersion

The version token of the resource the occurrences were computed from; a change invalidates the entry.

public string ResourceVersion { get; init; }

Property Value

string

Territory

The normalized territory the occurrences were resolved for.

public string Territory { get; init; }

Property Value

string

Year

The civil year the occurrences were emitted within.

public int Year { get; init; }

Property Value

int

Methods

Deconstruct(out string, out int, out string, out IReadOnlyList<NotableDate>, out DateTimeOffset)

public void Deconstruct(out string Territory, out int Year, out string ResourceVersion, out IReadOnlyList<NotableDate> Occurrences, out DateTimeOffset ComputedAtUtc)

Parameters

Territory string
Year int
ResourceVersion string
Occurrences IReadOnlyList<NotableDate>
ComputedAtUtc DateTimeOffset

Equals(NotableDateCacheEntry?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(NotableDateCacheEntry? other)

Parameters

other NotableDateCacheEntry

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

IsFresh(DateTimeOffset, TimeSpan)

Reports whether the entry is still fresh at asOf under the supplied time-to-live.

public bool IsFresh(DateTimeOffset asOf, TimeSpan ttl)

Parameters

asOf DateTimeOffset

The instant against which freshness is evaluated.

ttl TimeSpan

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

Returns

bool

true when asOf is within ttl of ComputedAtUtc; otherwise false.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator ==(NotableDateCacheEntry?, NotableDateCacheEntry?)

public static bool operator ==(NotableDateCacheEntry? left, NotableDateCacheEntry? right)

Parameters

left NotableDateCacheEntry
right NotableDateCacheEntry

Returns

bool

operator !=(NotableDateCacheEntry?, NotableDateCacheEntry?)

public static bool operator !=(NotableDateCacheEntry? left, NotableDateCacheEntry? right)

Parameters

left NotableDateCacheEntry
right NotableDateCacheEntry

Returns

bool

Applies to

ProductVersions
.NET8, 10