Class RedissonRateLimiter
java.lang.Object
org.oxerr.rescu.ext.ratelimiter.redisson.RedissonRateLimiter
- All Implemented Interfaces:
RateLimiter
-
Constructor Summary
ConstructorDescriptionRedissonRateLimiter
(org.redisson.api.RedissonClient redisson, String name) RedissonRateLimiter
(org.redisson.api.RRateLimiter rateLimiter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquire()
Acquires a permit from this RateLimiter, blocking until one is available.org.redisson.api.RRateLimiter
void
setRate
(org.redisson.api.RateType mode, long rate, long rateInterval, org.redisson.api.RateIntervalUnit rateIntervalUnit) Updates RateLimiter's state and stores config to Redis server.
-
Constructor Details
-
RedissonRateLimiter
public RedissonRateLimiter(org.redisson.api.RRateLimiter rateLimiter) -
RedissonRateLimiter
-
-
Method Details
-
setRate
public void setRate(org.redisson.api.RateType mode, long rate, long rateInterval, org.redisson.api.RateIntervalUnit rateIntervalUnit) Updates RateLimiter's state and stores config to Redis server.- Parameters:
mode
- - rate moderate
- - raterateInterval
- - rate time intervalrateIntervalUnit
- - rate time interval unit
-
acquire
public void acquire()Description copied from interface:RateLimiter
Acquires a permit from this RateLimiter, blocking until one is available.Acquires a permit, if one is available and returns immediately, reducing the number of available permits by one.
- Specified by:
acquire
in interfaceRateLimiter
-
getRateLimiter
public org.redisson.api.RRateLimiter getRateLimiter()
-