View Source Hammer.Backend behaviour (hammer v6.1.0)

The backend Behaviour module.

Link to this section Summary

Link to this section Types

Specs

bucket_info() ::
  {key :: bucket_key(), count :: integer(), created :: integer(),
   updated :: integer()}

Specs

bucket_key() :: {bucket :: integer(), id :: String.t()}

Link to this section Callbacks

Link to this callback

count_hit( pid, key, now )

View Source

Specs

count_hit(
  pid :: pid(),
  key :: bucket_key(),
  now :: integer()
) :: {:ok, count :: integer()} | {:error, reason :: any()}
Link to this callback

count_hit( pid, key, now, increment )

View Source

Specs

count_hit(
  pid :: pid(),
  key :: bucket_key(),
  now :: integer(),
  increment :: integer()
) :: {:ok, count :: integer()} | {:error, reason :: any()}
Link to this callback

delete_buckets( pid, id )

View Source

Specs

delete_buckets(
  pid :: pid(),
  id :: String.t()
) :: {:ok, count_deleted :: integer()} | {:error, reason :: any()}

Specs

get_bucket(
  pid :: pid(),
  key :: bucket_key()
) :: {:ok, info :: bucket_info()} | {:ok, nil} | {:error, reason :: any()}