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
TKey
Cache entry's key (identifier) type.
TValue
Cache 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
Key
TKeyKey of an entry associated with this event.
Removed
TValueValue of a removed entry associated with this event.
Replacement
TValueValue of an entry that replaced the Removed value associated with this event.
IsReplaced
boolIndicates 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
key
TKeyKey of the removed cache entry.
removed
TValueValue 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
key
TKeyKey of the cache entry.
removed
TValueRemoved value associated with the
key
.replacement
TValueValue associated with the
key
which replaced theremoved
value.
Returns
- CachedItemRemovalEvent<TKey, TValue>
CachedItemRemovalEvent<TKey, TValue> instance with a Replacement value.