X402.Extensions.PaymentIdentifier.RedisCache.Command behaviour (X402 v0.6.0)

Copy Markdown View Source

Behaviour for the Redis command layer used by X402.Extensions.PaymentIdentifier.RedisCache.

The single callback mirrors Redix.command/2: it executes one Redis command against a connection and returns the reply. Redix itself satisfies the behaviour structurally and is the default; tests (or alternative Redis clients with a compatible reply shape) can supply their own module through the adapter's :command option.

Summary

Callbacks

Executes a single Redis command against conn.

Callbacks

command(conn, command)

@callback command(conn :: term(), command :: [String.t()]) ::
  {:ok, term()} | {:error, term()}

Executes a single Redis command against conn.

Must follow Redix.command/2 semantics: {:ok, reply} with the decoded RESP reply ("OK", nil, a binary, or an integer for the commands this adapter issues), or {:error, reason} for connection or protocol errors.