SimpleBucketStateMapWithEviction
class SimpleBucketStateMapWithEviction(clock: Clock, stateMap: SimpleBucketStateMap = SimpleBucketStateMap(), ttlAfterLastAccess: Duration = 2.hours, expirationCheckInterval: Duration = 10.minutes, coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.Default)) : BucketStateMap
A simple in-memory state map implementation that expires keys after a given time-to-live.
Parameters
clock
the clock to use to get the current time
stateMap
the state map to use to store the state
ttlAfterLastAccess
the time-to-live after the last access
expirationCheckInterval
the interval at which to check for expired keys
coroutineScope
the CoroutineScope to use to run the expiration check
Constructors
Link copied to clipboard
constructor(clock: Clock, stateMap: SimpleBucketStateMap = SimpleBucketStateMap(), ttlAfterLastAccess: Duration = 2.hours, expirationCheckInterval: Duration = 10.minutes, coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.Default))
Functions
Link copied to clipboard
Link copied to clipboard
open override fun putIfAbsent(key: String, value: AtomicReference<BucketState>): AtomicReference<BucketState>?