EvictingDictionaryExpirationKind Enum
Definition
Specifies how an EvictingDictionary<TKey, TValue> measures an entry's time-to-live when expiration is configured through EvictingDictionaryExpiration.
public enum EvictingDictionaryExpirationKind
- Extension Methods
Fields
Absolute = 0The entry expires a fixed interval after it was added or last updated; read accesses do not extend its lifetime.
Sliding = 1The entry's expiration deadline is refreshed on every successful read access (
TryGetValueor the indexer getter), so the entry expires only after remaining unread for its full time-to-live.
Remarks
The kind determines the point from which an entry's time-to-live is counted. Under Absolute the countdown starts when the entry is added (or its value is updated) and is unaffected by reads. Under Sliding every successful read that returns the value - TryGetValue(TKey, out TValue) and the indexer getter - restarts the countdown, keeping actively read entries alive indefinitely.
ContainsKey(TKey), Touch(TKey), and enumeration never refresh an entry's lifetime under either kind.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |