semaphore

@ExperimentalCoroutinesApi
fun RedissonClient.semaphore(name: String, concurrencyLevel: Int, leaseTime: Duration = 10.seconds): suspend CoroutineScope.() -> AsyncSemaphore<String>

Returns a suspending function that creates an AsyncSemaphore using a Redisson semaphore. The semaphore is created the first time the returned function is invoked.

Return

A suspending function that creates an AsyncSemaphore when invoked.

Parameters

name

The name of the semaphore in Redisson.

concurrencyLevel

The total number of permits this semaphore can provide.

leaseTime

The time after which a permit is automatically released. Default value is 10 seconds.