allowEvery

fun allowEvery(key: K, minIntervalMillis: Long): Boolean

Tries to allow an action for the specified key with a minimum interval in milliseconds.

If the current time is greater than or equal to the next allowed time, the action is allowed and the next allowed time is updated to (current time + minIntervalMillis).

Return

true if allowed and the next allowed time was updated, false otherwise

Parameters

key

the key to check and update

minIntervalMillis

the minimum interval between allowed actions in milliseconds

Throws


fun allowEvery(key: K, minInterval: Duration): Boolean

Tries to allow an action for the specified key with a minimum interval using a Duration.

Return

true if allowed and the next allowed time was updated, false otherwise

Parameters

key

the key to check and update

minInterval

the minimum interval Duration between allowed actions