The acquire
method acquires a slot only if the slot limit is not reached.
Returns true if the slot limit is not reached otherwise false is returned.
The getState
method returns the state of the semaphore.
Returns ISemaphoreAdapterState
if the semaphore exists in the database or null if doesnt exists.
To utilize the
RedisSemaphoreAdapter
, you must install the"ioredis"
package.Note in order to use
RedisSemaphoreAdapter
correctly, ensure you use a single, consistent database across all server instances.IMPORT_PATH:
"@daiso-tech/core/semaphore/adapters"