Table of Contents

IFileRateCache Interface

Definition

Namespace
Bodu.Financial.ExchangeRates.Caching
Assembly
Bodu.Financial.ExchangeRates.Caching.dll
Package
Bodu.Financial.ExchangeRates.Caching 1.0.0
Source
IFileRateCache.cs

Specializes IRateCache for caches that persist rates as files, exposing the storage directory and the file or directory a pair resolves to under the configured layout.

public interface IFileRateCache : IRateCache
Inherited Members
Extension Methods

Remarks

This is the file-storage seam of the caching design. Other storage kinds define their own specialization of IRateCache (for example a database cache exposing a table or connection name); consumers that only need the storage-agnostic contract continue to depend on IRateCache.

Properties

CacheDirectory

Gets the directory in which cached rate files are stored.

string CacheDirectory { get; }

Property Value

string

The absolute or relative cache directory path.

Methods

ResolveDirectory(CurrencyPair)

Resolves the directory that holds the supplied pair's cache file or files for this cache's provider.

string ResolveDirectory(CurrencyPair pair)

Parameters

pair CurrencyPair

The currency pair.

Returns

string

The directory the pair's rates are stored in.

ResolveFilePath(CurrencyPair)

Resolves the full path of the single file that backs the supplied pair for this cache's provider.

string ResolveFilePath(CurrencyPair pair)

Parameters

pair CurrencyPair

The currency pair.

Returns

string

The resolved file path the pair's rates are read from and written to.

Exceptions

InvalidOperationException

Thrown when the cache uses a partitioned layout, where a pair has no single backing file; use ResolveDirectory(CurrencyPair) or ResolvePartitionPath(CurrencyPair, DateOnly) instead.

ResolvePartitionPath(CurrencyPair, DateOnly)

Resolves the full path of the file that backs the supplied pair's rates for the partition containing date.

string ResolvePartitionPath(CurrencyPair pair, DateOnly date)

Parameters

pair CurrencyPair

The currency pair.

date DateOnly

A date within the partition whose file is required.

Returns

string

The resolved partition file path. For a single-file layout this is the pair's one file regardless of date.

Applies to

ProductVersions
.NET8, 10