Behaviour and adapter helpers for payment identifier idempotency caches.
Cache adapters are configured as {module, cache} tuples where module
implements this behaviour and cache is adapter-specific runtime state
(for example, a pid or registered process name).
Summary
Types
Adapter tuple accepted by X402.Plug.PaymentGate.
Result returned by get/2.
Payment identifier cache key.
Value stored for a given payment identifier.
Result returned by write/delete operations.
Functions
Deletes a cached value for a payment identifier.
Reads a cached value for a payment identifier.
Stores a cached value for a payment identifier.
Validates a cache adapter tuple for NimbleOptions custom validation.
Validates an optional cache adapter for NimbleOptions.
Types
Adapter tuple accepted by X402.Plug.PaymentGate.
Result returned by get/2.
@type key() :: X402.Extensions.PaymentIdentifier.payment_id()
Payment identifier cache key.
@type value() :: :verified | {:rejected, term()}
Value stored for a given payment identifier.
@type write_result() :: :ok | {:error, term()}
Result returned by write/delete operations.
Callbacks
@callback delete(cache :: term(), key()) :: write_result()
@callback get(cache :: term(), key()) :: get_result()
@callback put(cache :: term(), key(), value()) :: write_result()
Functions
@spec delete(adapter(), key()) :: write_result()
Deletes a cached value for a payment identifier.
@spec get(adapter(), key()) :: get_result()
Reads a cached value for a payment identifier.
@spec put(adapter(), key(), value()) :: write_result()
Stores a cached value for a payment identifier.
Validates a cache adapter tuple for NimbleOptions custom validation.
Validates an optional cache adapter for NimbleOptions.
nil disables idempotency caching.