TokenInMemoryLruCacheTKey, TValue - конструктор
Represents an in-memory Least Recently Used (LRU) cache for tokens.
This cache automatically removes the least recently used tokens when the capacity is exceeded.
It also supports automatic cleanup of tokens, based on a configurable cleanup period.
Пространство имён: Tessa.Tokens.CachingСборка: Tessa (в Tessa.dll) Версия: 4.1.3+7e2b1422f9b8c7c41fbbc4b151a843bed05319ab
public TokenInMemoryLruCache(
IClock clock,
int capacity,
Func<TimeSpan> getCleanupPeriodFunc,
Func<TKey, TValue, bool>? cleanupPredicate = null
)
Public Sub New (
clock As IClock,
capacity As Integer,
getCleanupPeriodFunc As Func(Of TimeSpan),
Optional cleanupPredicate As Func(Of TKey, TValue, Boolean) = Nothing
)
public:
TokenInMemoryLruCache(
IClock^ clock,
int capacity,
Func<TimeSpan>^ getCleanupPeriodFunc,
Func<TKey, TValue, bool>^ cleanupPredicate = nullptr
)
new :
clock : IClock *
capacity : int *
getCleanupPeriodFunc : Func<TimeSpan> *
?cleanupPredicate : Func<'TKey, 'TValue, bool>
(* Defaults:
let _cleanupPredicate = defaultArg cleanupPredicate null
*)
-> TokenInMemoryLruCache
Параметры
- clock IClock
Объект для предоставления текущего времени в формате Utc.
- capacity Int32
The maximum number of tokens that the cache can store.
When the cache exceeds this capacity, the least recently used (LRU) entry will be removed.
- getCleanupPeriodFunc FuncTimeSpan
Period after which tokens should be removed from the cache.
Allowed values:
- < 0 – no automatic cleanup will occur;
- 0 – cleaning each time the token is received;
- > 0 – cleaning at specified intervals.
- cleanupPredicate FuncTKey, TValue, Boolean (Optional)
A predicate function used to determine whether a cache entry should be removed during cleanup,
or null, if all cached entries can be cleaned up.