Chisle
The coding-agent plugin that bills 52% of a bare model across 20 live tasks. Terse persona + tool-output compressor + context diet.
翻訳待ち
Java rate limiting library based on token-bucket algorithm.
翻訳待ち
開発ツールJava · HTMLGitHub @bucket4j自分でインストール所有者未確認
Paste into Claude or ChatGPT for installation instructions suited to your environment.
Have you tried it? One tap is enough. No sign-in needed.
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗The Bucket4j is distributed through Maven Central:
<!-- For java 17+ -->
<dependency>
<groupId>com.bucket4j</groupId>
<artifactId>bucket4j_jdk17-core</artifactId>
<version>8.23.0</version>
</dependency>
import io.github.bucket4j.Bucket;
...
// bucket with capacity 20 tokens and with refilling speed 1 token per each 6 second
private static Bucket bucket = Bucket.builder()
.addLimit(limit -> limit.capacity(20).refillGreedy(10, Duration.ofMinutes(1)))
.build();
private void doSomethingProtected() {
if (bucket.tryConsume(1)) {
doSomething();
} else {
throw new SomeRateLimitingException();
}
}
More examples can be found there
In additional to basic features described above, Bucket4j provides ability to implement rate-limiting in cluster of JVMs:
Bucket4j is not a framework, it is a library, with Bucket4j you need to write a code to achive your goals. For generic use-cases, try to look at powerfull Spring Boot Starter for Bucket4j, that allows you to set access limits on your API effortlessly. Its key advantage lies in the configuration via properties or yaml files, eliminating the need for manual code authoring.
In addition to local in-memory buckets, the Bucket4j supports clustered usage scenario on top of following back-ends:
| Back-end | Async supported | Flexible per-entry expiration | Optimized serialization | Thin-client support | Documentation link |
|---|---|---|---|---|---|
JCache API (JSR 107) | No | No | No | No | bucket4j-jcache |
Hazelcast | Yes | Yes | Yes | No | bucket4j-hazelcast |
Apache Ignite | Yes | No | n/a | Yes | bucket4j-ignite |
Apache Ignite 3 | Yes | No | n/a | Yes | bucket4j-ignite3 |
Inifinispan | Yes | Yes | Yes | No | bucket4j-infinispan |
Oracle Coherence | Yes | Yes | Yes | No | bucket4j-coherence |
Couchbase | Yes | Yes | Yes |
This is the beginning of the README. Read the rest at the original. Read the full README ↗
| No |
| bucket4j-couchbase |
Apache Geode (GemFire) | No | No | n/a | No | bucket4j-geode |