RateCacheWarmupOptions Class
Definition
- Namespace
- Bodu.Financial.ExchangeRates.Caching
- Assembly
- Bodu.Financial.ExchangeRates.Caching.dll
- Package
- Bodu.Financial.ExchangeRates.Caching 1.0.0
Configures the startup cache warm-up registered through AddRateCacheWarmup: the currency pairs to warm and
the date window they are warmed over.
public sealed class RateCacheWarmupOptions
- Inheritance
-
RateCacheWarmupOptions
- Inherited Members
- Extension Methods
Remarks
The warmed window defaults to a rolling look-back from the current UTC date - [today −
LookbackDays, today], evaluated when the warm-up runs - so a service that restarts daily always
warms its recent history. Either bound can be pinned with StartDate or EndDate; a
pinned bound replaces its rolling default independently of the other.
Pairs are ISO 4217 code pairs in "XXX/YYY" form, binding cleanly from configuration arrays. Validation checks
the shape only; a well-formed pair whose code is unknown to the currency registry surfaces at warm-up time as a
logged, skipped pair rather than failing application start.
Constructors
RateCacheWarmupOptions()
public RateCacheWarmupOptions()
Properties
EndDate
Gets or sets the fixed inclusive last date of the warmed window, replacing the rolling current-date end.
public DateOnly? EndDate { get; set; }
Property Value
LookbackDays
Gets or sets the number of days before the current UTC date the warmed window reaches back, used when StartDate is not set.
public int LookbackDays { get; set; }
Property Value
- int
The rolling look-back, in days; defaults to 30. Must not be negative.
Pairs
Gets the currency pairs to warm, each in "XXX/YYY" ISO 4217 form.
public IList<string> Pairs { get; }
Property Value
Providers
Gets the names of keyed aggregation children to warm in addition to every directly registered caching provider.
public IList<string> Providers { get; }
Property Value
StartDate
Gets or sets the fixed inclusive first date of the warmed window, replacing the rolling LookbackDays start.
public DateOnly? StartDate { get; set; }
Property Value
- DateOnly?
The fixed start date, or null to derive the start from LookbackDays.
Methods
TryValidate(out string?)
Attempts to validate the options without throwing, reporting the first invariant that is violated.
public bool TryValidate(out string? error)
Parameters
errorstringWhen this method returns false, a message describing the first violated invariant; otherwise null.
Returns
Validate()
Validates the option values, throwing when a rule is violated.
public void Validate()
Remarks
This throwing form preserves the ParamName of the offending option. The dependency-injection registration
instead wires TryValidate(out string?) into ValidateOnStart.
Exceptions
- ArgumentException
Thrown when Pairs is empty or contains a malformed pair, when LookbackDays is negative, or when StartDate and EndDate are both set and inverted.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |