Class BucketStore

java.lang.Object
dev.relism.flash.ext.limiter.BucketStore

public final class BucketStore extends Object
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 Details

    • BucketStore

      public BucketStore()
  • Method Details

    • get

      public Bucket get(String key)
      Returns the bucket for key, creating one if absent. Two threads racing on the same new key are guaranteed to receive the same bucket instance.