SemaphoreState
Represents the abstract state of a semaphore used by a RateLimiter which, depending on the implementation, can be stored in-memory or externally (e.g., in a database or cache). Additionally, an internal queue is used to store the requests that are waiting for permits to be available. If this state is to be shared between multiple instances of the rate limiter, it should be thread-safe. If not, it is protected by the rate limiter's internal synchronization mechanisms.
The state enforces a disposable pattern by implementing the AutoCloseable interface.
See also
Inheritors
Properties
The number of permits currently in use (i.e., permits that have been acquired but not yet released).
The queue to store the requests that are waiting for permits to be available.
The time mark indicating when the semaphore state was last replenished. It is used to determine when the rate limiting replenishment period has passed.