Class RateLimiter
java.lang.Object
org.miaixz.bus.limiter.support.rate.RateLimiter
- All Implemented Interfaces:
Limiter<RateLimiter>
- Direct Known Subclasses:
JdkRateLimiter,RedisRatelimiter
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanboolean对一个键值进行限制操作,并使用 args 参数 例如实现一个速率限制器,则 args 通常为速率参数void对于一个键值释放限制,例如locker 对应于locker 的unlock 操作 某些种类的没有对应的释放操作 例如速率限制器 这是该方法应该是空实现Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.miaixz.bus.limiter.Limiter
getLimiterName
-
Constructor Details
-
RateLimiter
public RateLimiter()
-
-
Method Details
-
acquire
-
limit
Description copied from interface:Limiter对一个键值进行限制操作,并使用 args 参数 例如实现一个速率限制器,则 args 通常为速率参数- Specified by:
limitin interfaceLimiter<RateLimiter>- Parameters:
key- 键args- 参数- Returns:
- true/false
-
release
Description copied from interface:Limiter对于一个键值释放限制,例如locker 对应于locker 的unlock 操作 某些种类的没有对应的释放操作 例如速率限制器 这是该方法应该是空实现- Specified by:
releasein interfaceLimiter<RateLimiter>- Parameters:
key- 键args- 参数
-