Struct CachedItemRemovalEvent<TKey, TValue>
A lightweight representation of an event that signals removal of an entry from an ICache<TKey, TValue>.
public readonly record struct CachedItemRemovalEvent<TKey, TValue> : IEquatable<CachedItemRemovalEvent<TKey, TValue>>
Type Parameters
TKeyCache entry's key (identifier) type.
TValueCache entry's value type.
- Implements
-
IEquatable<CachedItemRemovalEvent<TKey, TValue>>
- Inherited Members
- Extension Methods
Constructors
CachedItemRemovalEvent(TKey, TValue, TValue?, bool)
A lightweight representation of an event that signals removal of an entry from an ICache<TKey, TValue>.
public CachedItemRemovalEvent(TKey Key, TValue Removed, TValue? Replacement, bool IsReplaced)
Parameters
KeyTKeyKey of an entry associated with this event.
RemovedTValueValue of a removed entry associated with this event.
ReplacementTValueValue of an entry that replaced the Removed value associated with this event.
IsReplacedboolIndicates whether or not this event contains a Replacement value.
Properties
IsReplaced
Indicates whether or not this event contains a Replacement value.
public bool IsReplaced { get; init; }
Property Value
Key
Key of an entry associated with this event.
public TKey Key { get; init; }
Property Value
- TKey
Removed
Value of a removed entry associated with this event.
public TValue Removed { get; init; }
Property Value
- TValue
Replacement
Value of an entry that replaced the Removed value associated with this event.
public TValue? Replacement { get; init; }
Property Value
- TValue
Methods
CreateRemoved(TKey, TValue)
Creates a new CachedItemRemovalEvent<TKey, TValue> instance.
[Pure]
public static CachedItemRemovalEvent<TKey, TValue> CreateRemoved(TKey key, TValue removed)
Parameters
keyTKeyKey of the removed cache entry.
removedTValueValue of the removed cache entry.
Returns
- CachedItemRemovalEvent<TKey, TValue>
CachedItemRemovalEvent<TKey, TValue> instance without a Replacement value.
CreateReplaced(TKey, TValue, TValue)
Creates a new CachedItemRemovalEvent<TKey, TValue> instance with Replacement value.
[Pure]
public static CachedItemRemovalEvent<TKey, TValue> CreateReplaced(TKey key, TValue removed, TValue replacement)
Parameters
keyTKeyKey of the cache entry.
removedTValueRemoved value associated with the
key.replacementTValueValue associated with the
keywhich replaced theremovedvalue.
Returns
- CachedItemRemovalEvent<TKey, TValue>
CachedItemRemovalEvent<TKey, TValue> instance with a Replacement value.