Table of Contents

FileSystemEcbFeedCache Class

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Ecb.dll
Package
Bodu.Financial.ExchangeRates.Ecb 0.7.1
Source
FileSystemEcbFeedCache.cs

An IByteCache<TKey> that persists downloaded ECB feeds as files in a cache directory, keyed by the feed that produced them.

public sealed class FileSystemEcbFeedCache : FileSystemByteCache<EcbRateFeed>, IByteCache<EcbRateFeed>
Inheritance
FileSystemEcbFeedCache
Implements
Inherited Members
Extension Methods

Remarks

Each feed is stored under its file name in the cache directory; the file's last-write time serves as the freshness timestamp. Because every ECB feed extends to the most recent business day, a cached file 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

FileSystemEcbFeedCache(string?, ILogger?)

Initializes a new instance of the FileSystemEcbFeedCache class.

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

Parameters

directory string

The cache directory. When null or empty, a bodu-ecb 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(EcbRateFeed)

Derives the cache file name for a key.

protected override string GetFileName(EcbRateFeed key)

Parameters

key EcbRateFeed

The download unit to name.

Returns

string

The cache file name.

Applies to

ProductVersions
.NET8, 10