set

fun set(key: K, cooldownMillis: Long, onExpiry: () -> Unit = {})

Sets the cooldown for the specified key in milliseconds.

Parameters

key

the key to set the cooldown for

cooldownMillis

the duration of the cooldown in milliseconds. Must be non-negative.

onExpiry

optional callback to execute when the cooldown expires

Throws


fun set(key: K, cooldown: Duration, onExpiry: () -> Unit = {})

Sets the cooldown for the specified key using a Duration.

Parameters

key

the key to set the cooldown for

cooldown

the Duration of the cooldown

onExpiry

optional callback to execute when the cooldown expires