Table of Contents

FileSystemBoeResponseCache Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Boe.dll
Package
Bodu.Financial.ExchangeRates.Boe 0.7.1
Source
FileSystemBoeResponseCache.cs

An IByteCache<TKey> that persists downloaded IADB range responses as files in a cache directory, keyed by the inclusive date range that produced them.

public sealed class FileSystemBoeResponseCache : FileSystemByteCache<(DateOnly StartDate, DateOnly EndDate)>, IByteCache<(DateOnly StartDate, DateOnly EndDate)>
Inheritance
FileSystemBoeResponseCache
Implements
Inherited Members
Extension Methods

Remarks

Each range is stored under a file name derived from its inclusive bounds; the file's last-write time serves as the freshness timestamp. A cached response is treated as stale once it exceeds the supplied refresh interval, forcing a re-download.

The cache is best-effort: any I/O failure while reading is reported as a miss, and any failure while writing is swallowed, so a cache problem never breaks rate retrieval.

Constructors

FileSystemBoeResponseCache(string?, ILogger?)

Initializes a new instance of the FileSystemBoeResponseCache class.

public FileSystemBoeResponseCache(string? directory, ILogger? logger = null)

Parameters

directory string

The cache directory. When null or empty, a bodu-boe folder under the system temporary path is used.

logger ILogger

The logger that receives a warning when a best-effort file-system failure is swallowed, or null to disable that reporting.

Methods

GetFileName((DateOnly StartDate, DateOnly EndDate))

Derives the cache file name for a key.

protected override string GetFileName((DateOnly StartDate, DateOnly EndDate) key)

Parameters

key (DateOnly StartDate, DateOnly EndDate)

The download unit to name.

Returns

string

The cache file name.

Applies to

ProductVersions
.NET8, 10