evoq_idempotency (evoq v1.8.2)

View Source

ETS-based command idempotency store.

Stores command results by command_id for deduplication. Duplicate commands return the cached result instead of re-executing against the aggregate.

Uses ETS with automatic TTL-based expiration.

Summary

Functions

Check for existing result or execute and store. This is the main entry point for idempotent command execution.

Delete a command result.

Lookup a command result.

Start the idempotency store.

Store a command result.

Functions

check_and_store(CommandId, ExecuteFun, TTL)

-spec check_and_store(binary(), fun(() -> term()), pos_integer()) -> term().

Check for existing result or execute and store. This is the main entry point for idempotent command execution.

delete(CommandId)

-spec delete(binary()) -> ok.

Delete a command result.

lookup(CommandId)

-spec lookup(binary()) -> {ok, term()} | not_found.

Lookup a command result.

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

Start the idempotency store.

store(CommandId, Result, TTL)

-spec store(binary(), term(), pos_integer()) -> ok.

Store a command result.