View Source IdempotencyPlug.Store behaviour (IdempotencyPlug v0.2.1)

Module that defines the store callbacks.

examples

Examples

defmodule CustomStore do
  @behaviour IdempotencyPlug.Store

  @impl true
  def setup(options)

  @impl true
  def lookup(request_id, options)

  @impl true
  def insert(request_id, fingerprint, data, options)

  @impl true
  def update(request_id, data, options)

  @impl true
  def prune(options)
end

Link to this section Summary

Link to this section Types

@type data() :: term()
@type expires_at() :: DateTime.t()
@type fingerprint() :: binary()
@type options() :: keyword()
@type request_id() :: binary()

Link to this section Callbacks

Link to this callback

insert(request_id, data, fingerprint, expires_at, options)

View Source
@callback insert(request_id(), data(), fingerprint(), expires_at(), options()) ::
  :ok | {:error, term()}
Link to this callback

lookup(request_id, options)

View Source
@callback lookup(request_id(), options()) ::
  {data(), fingerprint(), expires_at()} | :not_found
@callback prune(options()) :: :ok
@callback setup(options()) :: :ok | {:error, term()}
Link to this callback

update(request_id, data, expires_at, options)

View Source
@callback update(request_id(), data(), expires_at(), options()) :: :ok | {:error, term()}