Package dev.relism.flash.ext.limiter
Class BucketStore
java.lang.Object
dev.relism.flash.ext.limiter.BucketStore
Thread-safe store of pre-allocated
Bucket instances keyed by partition key.
On the warm path (key already seen), get(java.lang.String) performs a single
ConcurrentHashMap lookup — no allocation. On the cold path (new key),
computeIfAbsent allocates exactly one Bucket and inserts it.
Buckets accumulate indefinitely; for workloads with unbounded unique keys (e.g. one-shot crawlers), consider periodic store replacement or a bounded LRU map implementation.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
BucketStore
public BucketStore()
-
-
Method Details
-
get
Returns the bucket forkey, creating one if absent. Two threads racing on the same new key are guaranteed to receive the same bucket instance.
-