hammer v0.2.1 Hammer.Backend.ETS View Source
An ETS backend for Hammer
The public API of this module is used by Hammer to store information about rate-limit ‘buckets’.
A bucket is identified by a key
, which is a tuple {bucket_number, id}
.
The essential schema of a bucket is: {key, count, created_at, updated_at}
, although backends
are free to store and retrieve this data in whichever way they wish.
Link to this section Summary
Functions
Record a hit in the bucket identified by key
Delete all buckets associated with id
Retrieve information about the bucket identified by key
Link to this section Functions
Link to this function
count_hit(key, now)
View Source
count_hit(key :: {bucket :: integer, id :: String.t}, now :: integer) :: {:ok, count :: integer} | {:error, reason :: any}
Record a hit in the bucket identified by key
Link to this function
delete_buckets(id)
View Source
delete_buckets(id :: String.t) :: {:ok, count_deleted :: integer} | {:error, reason :: any}
Delete all buckets associated with id
.
Retrieve information about the bucket identified by key