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

The backend Behaviour module.

Summary

Types

@type bucket_info() ::
  {key :: bucket_key(), count :: integer(), created :: integer(),
   updated :: integer()}
@type bucket_key() :: {bucket :: integer(), id :: String.t()}

Callbacks

Link to this callback

count_hit(pid, key, now)

View Source
@callback 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
@callback count_hit(
  pid :: pid(),
  key :: bucket_key(),
  now :: integer(),
  increment :: integer()
) :: {:ok, count :: integer()} | {:error, reason :: any()}
@callback delete_buckets(
  pid :: pid(),
  id :: String.t()
) :: {:ok, count_deleted :: integer()} | {:error, reason :: any()}
@callback get_bucket(
  pid :: pid(),
  key :: bucket_key()
) :: {:ok, info :: bucket_info()} | {:ok, nil} | {:error, reason :: any()}