tryAcquire

abstract fun tryAcquire(key: String, maxCallsPerWindow: Int): Boolean

Attempts to record one call for key within the current time window.

Return

true if the call is within the limit and should proceed; false if the limit is exceeded and the call should be rejected

Parameters

key

identifies the rate-limited resource (e.g. commandTypeId or "callerPackage:commandTypeId")

maxCallsPerWindow

maximum number of calls allowed within the configured window