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
TerritorystringThe normalized territory the occurrences were resolved for.
YearintThe civil year the occurrences were emitted within.
ResourceVersionstringThe version token of the resource the occurrences were computed from; a change invalidates the entry.
OccurrencesIReadOnlyList<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.ComputedAtUtcDateTimeOffsetThe 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
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
ResourceVersion
The version token of the resource the occurrences were computed from; a change invalidates the entry.
public string ResourceVersion { get; init; }
Property Value
Territory
The normalized territory the occurrences were resolved for.
public string Territory { get; init; }
Property Value
Year
The civil year the occurrences were emitted within.
public int Year { get; init; }
Property Value
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
TerritorystringYearintResourceVersionstringOccurrencesIReadOnlyList<NotableDate>ComputedAtUtcDateTimeOffset
Equals(NotableDateCacheEntry?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(NotableDateCacheEntry? other)
Parameters
otherNotableDateCacheEntryAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
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
asOfDateTimeOffsetThe instant against which freshness is evaluated.
ttlTimeSpanThe duration a computed year remains fresh after it was computed.
Returns
- bool
true when
asOfis withinttlof 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
leftNotableDateCacheEntryrightNotableDateCacheEntry
Returns
operator !=(NotableDateCacheEntry?, NotableDateCacheEntry?)
public static bool operator !=(NotableDateCacheEntry? left, NotableDateCacheEntry? right)
Parameters
leftNotableDateCacheEntryrightNotableDateCacheEntry
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |