基于 redis 的偏业务应用的分布式限流组件,使得项目拥有分布式限流能力变得很简单。
rateLimiterRedissonBeanName
,应用也可以获取使用令牌桶
的限流策略支持RateLimiterService
,并在 Spring 上下文中声明了,应用可以直接注入使用maven
<dependency>
<groupId>com.github.taptap</groupId>
<artifactId>ratelimiter-spring-boot-starter</artifactId>
<version>1.3</version>
</dependency>
gradle
implementation 'com.taptap:ratelimiter-spring-boot-starter:1.3'
1、触发限流时,响应的类型从 text/plain 变成了 application/json https://github.com/TapTap/ratelimiter-spring-boot-starter/commit/7b0dde45b70b5ab56b76d1baf529189458baddca 2、优化了限流的 lua 脚本,将原来的两步 lua 脚本请求,合并成了一个,减少了和 redis 的交互 https://github.com/TapTap/ratelimiter-spring-boot-starter/commit/9c179779bf5d670cec9e17154346e5732b6c9b53 3、限流的时间窗口大小,支持 Spel 从 Spring 的配置上下文中获取,结合 apollo 等配置中心后,支持规则的动态下发热更 https://github.com/TapTap/ratelimiter-spring-boot-starter/commit/c52149f098da4c171a127426256319c1ee81b4fa
maven
<dependency>
<groupId>com.github.taptap</groupId>
<artifactId>ratelimiter-spring-boot-starter</artifactId>
<version>1.2</version>
</dependency>
gradle
implementation 'com.taptap:ratelimiter-spring-boot-starter:1.2'