,System.Int32)} ,System.Int32,System.Action{-1})} ,System.Int32,System.Collections.Generic.IEqualityComparer{-0})} ,System.Int32,System.Action{-1},System.Collections.Generic.IEqualityComparer{-0})}
MemoizingMRUCache(Func, int) constructor¶
Defined in
Type: MemoizingMRUCacheSplat
Assembly: Splat.Logging.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471
Overloads¶
- 1.
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize) - 2.
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal> onRelease) - 3.
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, IEqualityComparer<TParam> paramComparer) - 4.
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal>? onRelease, IEqualityComparer<TParam> paramComparer)
1. Overload¶
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize)
Summary: Initializes a new instance of the MemoizingMRUCache class.
Parameters
| Name | Type | Description |
|---|---|---|
calculationFunc | Func | The calculation function used to produce values for missing keys. |
maxSize | int | The maximum number of entries retained in the cache. Must be > 0. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when calculationFunc is null. |
| System.ArgumentOutOfRangeException | Thrown when maxSize is less than or equal to zero. |
2. Overload¶
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal> onRelease)
Summary: Initializes a new instance of the MemoizingMRUCache class.
Parameters
| Name | Type | Description |
|---|---|---|
calculationFunc | Func | The calculation function used to produce values for missing keys. |
maxSize | int | The maximum number of entries retained in the cache. Must be > 0. |
onRelease | Action | Callback invoked when an entry is evicted or invalidated. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when calculationFunc or onRelease is null. |
| System.ArgumentOutOfRangeException | Thrown when maxSize is less than or equal to zero. |
3. Overload¶
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, IEqualityComparer<TParam> paramComparer)
Summary: Initializes a new instance of the MemoizingMRUCache class.
Parameters
| Name | Type | Description |
|---|---|---|
calculationFunc | Func | The calculation function used to produce values for missing keys. |
maxSize | int | The maximum number of entries retained in the cache. Must be > 0. |
paramComparer | IEqualityComparer | Equality comparer for keys. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when calculationFunc or paramComparer is null. |
| System.ArgumentOutOfRangeException | Thrown when maxSize is less than or equal to zero. |
4. Overload¶
public MemoizingMRUCache(Func<TParam, object?, TVal> calculationFunc, int maxSize, Action<TVal>? onRelease, IEqualityComparer<TParam> paramComparer)
Summary: Initializes a new instance of the MemoizingMRUCache class.
Parameters
| Name | Type | Description |
|---|---|---|
calculationFunc | Func | The calculation function used to produce values for missing keys. |
maxSize | int | The maximum number of entries retained in the cache. Must be > 0. |
onRelease | Action | Optional callback invoked when an entry is evicted or invalidated. |
paramComparer | IEqualityComparer | Equality comparer for keys. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when calculationFunc or paramComparer is null. |
| System.ArgumentOutOfRangeException | Thrown when maxSize is less than or equal to zero. |