Package dev.relism.flash.ext.limiter
Class Bucket
java.lang.Object
dev.relism.flash.ext.limiter.Bucket
Pre-allocated per-key rate limit state. Holds two
AtomicLong slots whose
semantics are strategy-specific:
- FIXED_WINDOW:
slot0= packed(epoch << 32 | count),slot1unused. - SLIDING_WINDOW:
slot0= packed(epoch << 32 | count),slot1= request count from the immediately preceding epoch. - TOKEN_BUCKET:
slot0= tokens × 1000 (scaled),slot1= last-refill timestamp (ms since epoch).
Buckets are created once per unique key (via BucketStore) and reused
for the lifetime of the server — zero allocation on the warm path.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
slot0
-
slot1
-
-
Constructor Details
-
Bucket
public Bucket()
-