Amarula.RetryCache.ETS (amarula v0.1.0)

View Source

In-memory Amarula.RetryCache adapter — the default.

One public, named ETS table per connection profile, holding {msg_id, entry}. Bounded to @max_entries; on overflow the oldest entries (by entry.ts) are evicted. State is lost on VM restart, which is acceptable: a retry receipt arrives within seconds of the original send.

The table is created lazily on first use and named by profile, so any process on the node can reach it. (A retry cache is shared, low-contention state; ETS's concurrent read/write suffices.)

Options

  • :max_entries — cap before eviction (default 200).

Summary

Functions

Create the profile's table. Called once by the supervised TableOwner at connection start (before any reader), so we never create lazily on first use — no create race, no rescue. Idempotent.

Functions

ensure_table(profile)

@spec ensure_table(atom() | String.t()) :: atom()

Create the profile's table. Called once by the supervised TableOwner at connection start (before any reader), so we never create lazily on first use — no create race, no rescue. Idempotent.