Table of Contents

IImfReportCache Interface

Definition

Namespace
Bodu.Financial.ExchangeRates
Assembly
Bodu.Financial.ExchangeRates.Imf.dll
Package
Bodu.Financial.ExchangeRates.Imf 0.7.1
Source
IImfReportCache.cs

Caches the raw bytes of downloaded IMF monthly report files so they need not be re-fetched on every load.

public interface IImfReportCache
Extension Methods

Remarks

A report for a closed month is immutable, so a cached entry for a past month is always fresh; the report for the current month is still accumulating business days, so it is treated as stale once it is older than a caller-supplied refresh interval. Implementations are expected to be resilient: a cache failure should manifest as a miss rather than an exception that breaks rate retrieval.

Methods

Store(ImfReportMonth, byte[])

Stores the bytes for a report month, replacing any existing entry.

void Store(ImfReportMonth month, byte[] bytes)

Parameters

month ImfReportMonth

The report month whose file is being cached.

bytes byte[]

The report bytes to store.

TryGet(ImfReportMonth, TimeSpan, out byte[])

Attempts to retrieve the cached bytes for a report month.

bool TryGet(ImfReportMonth month, TimeSpan refreshInterval, out byte[] bytes)

Parameters

month ImfReportMonth

The report month whose file is requested.

refreshInterval TimeSpan

The maximum age at which a current-month report is still considered fresh.

bytes byte[]

When this method returns true, the cached report bytes; otherwise null.

Returns

bool

true when a fresh cache entry exists; otherwise false.

Applies to

ProductVersions
.NET8, 10