ex_limiter v1.3.3 ExLimiter.Storage behaviour View Source

Link to this section Summary

Callbacks

Consumes n elements from the bucket (atomically)

Fetch the current state of the given bucket

Set the current state of the given bucket. Specify hard if you want to force a write

Atomically update the bucket denoted by key with fun. Leverage whatever concurrency controls are available in the given storage mechanism (eg cas for memcached)

Link to this section Types

Link to this type

response() View Source
response() :: {:ok, ExLimiter.Bucket.t()} | {:error, any()}

Link to this section Callbacks

Link to this callback

consume(bucket, incr) View Source
consume(bucket :: ExLimiter.Bucket.t(), incr :: integer()) ::
  {:ok, ExLimiter.Bucket.t()}

Consumes n elements from the bucket (atomically)

Fetch the current state of the given bucket

Link to this callback

refresh(bucket) View Source
refresh(bucket :: ExLimiter.Bucket.t()) :: response()

Set the current state of the given bucket. Specify hard if you want to force a write

Link to this callback

refresh(bucket, type) View Source
refresh(bucket :: ExLimiter.Bucket.t(), type :: :hard | :soft) :: response()

Atomically update the bucket denoted by key with fun. Leverage whatever concurrency controls are available in the given storage mechanism (eg cas for memcached)