echd — Echo on Encore · E4
The Memory — Tiers of Truth
Reads are answered from the nearest tier that can tell the truth — and coherence weighs twenty-nine bytes.
echd speaks in the present tense over a build ladder. Every module, verb, key, and port named on this page is real; the composition into one standing platform is the vision the ladder builds.
The chapter
echo_store — table.ex · coherence.ex · journal.exReads are answered from the nearest tier that can tell the truth. EchoStore is a declared near-cache: the ecc:{table}:{id} keyspace, values framed version<>value, an L1 of ETS tables over the shared L2 Valkey. The L1 is :public on purpose — a hit is a caller-side lookup that never enters the owner process — and the chapter names the contrast once, precisely: BCS systems keep :private tables to enforce the gate; the cache publishes its table to serve the read path. Two disciplines, one primitive, both deliberate — naming ETS without its discipline is the banned move; always say which.
Coherence is a message about a name: twenty-nine bytes, id:version, exactly two identities and a separator. In :tracking mode the store arms RESP3 client tracking — CLIENT TRACKING ON BCAST over the table's prefix, on a dedicated push connection — and an invalidation is one :ets.delete of one L1 row; the L2 is never touched by the push. Newer-wins is decided by mint order: the snowflake in the id is the only clock the protocol needs. Beneath it all, the journal — SQLite in WAL mode, a transactional outbox — records intents and replays the writes the network dropped, deduplicated by their recorded job ids at bus admission. The workshop writes through L2, watches the push delete the row, and measures the staleness window — the paper's dial, held in one table.
The read path
hover a leg[:set, :public, :named_table, read_concurrency], so a hit is one caller-side lookup that never serializes through the owner process. The contrast is the point: BCS keeps tables :private to enforce the gate; the cache publishes to serve the read path. Two disciplines, both deliberate.version<>value — the version is the id-shaped clock everything else compares by.id:version. The dedicated RESP3 connection is armed with CLIENT TRACKING ON BCAST over the table's prefix; a push deletes exactly one L1 row and touches nothing else. Newer-wins by mint order — no coordinator, no clock but the id's.intents outbox recorded transactionally. Replay re-uses the recorded job ids, so bus admission deduplicates absorbed retries — the write path degrades to durable, never to silent loss.Hover or focus a leg to read it; click to pin. Without scripting, all four read in sequence.
The modules
E4.1–E4.4The Keyspace and the Frame
ecc-keys · the-framed-value · fetch-and-put
L1 Public, On Purpose
caller-side-reads · single-flight-fill · two-ets-disciplines
Coherence, Three Ways
tracking-on-bcast · a-message-about-a-name · newer-wins-and-the-journal
Workshop — Watch an Invalidation Land
write-through-l2 · the-push-deletes-the-row · the-staleness-window
Doors
the sibling coursesReferences
sources · relatedSources
- Valkey — Client-side cachingthe RESP3 tracking protocol the push rides
- Erlang/OTP — etsthe term-storage primitive under both disciplines
Related
- Redis Patterns, Appliedthe caching family, pattern-first
- E2 — The Seamwhy the message carries only identities
- E5 — The Recordwhere memory hardens into history
- echd — the course homethe fourth switch on the switchboard