All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.dengchen2020.ratelimiter.RateLimiter Maven / Gradle / Ivy

There is a newer version: 0.0.28
Show newest version
package io.github.dengchen2020.ratelimiter;

/**
 * 限流接口
 *
 * @author dengchen
 * @since 2024/4/18
 */
public interface RateLimiter {

    /**
     * 是否被限制
     *
     * @param limitKey 限制标识符
     * @param limitNum 限制的次数
     * @return true:被限制 false:未被限制
     */
    boolean limit(String limitKey, int limitNum);

    /**
     * 撤销限制
     *
     * @param limitKey 限制标识符
     */
    default void quashLimit(String limitKey) {}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy