jonnify·bcs /bcs/store/the-near-cache

B4.1 · dive 1 of 3

The declared near-cache.

Part IV adds a cache, declared not discovered: L1 ETS tables in front of the L2 Valkey systems already share, every table registered in a directory that monitors its owner.

A declared directory over two tiers, L1 and L2. Select a part.
EchoStore directoryregister / spec / tablesusersorderssessionsa cache absent here does not existmonitors owners — a crash leaves the roster L1 · in-process ETS:public · read_concurrency — per node L2 · Valkey — ecc:{table}:idshared · hashtagged → one slotfill
readout · Select a part. EchoStore is the declared near-cache: a directory of registered tables over L1 in-process ETS and L2 shared Valkey by the ecc: keyspace.
§1

The idea

echo_store · echo_store.ex, table.ex, keyspace.ex

Part IV adds a cache, and its first law is that the cache is declared, not discovered. EchoStore is the near-cache layer: L1 ETS tables in front of the L2 Valkey that systems already share. Every table registers its full specification in a directory at start; an operator enumerates every cache on the node with tables/0; and a cache absent from the directory does not exist. There is no ambient, accidental cache — only declared ones, each with a kind, a TTL, and a coherence mode written down.

The two tiers divide by reach. L1 is an in-process ETS table, public and read-concurrent, local to one node; L2 is the shared Valkey the bus already runs on, addressed through the cache’s own keyspace, ecc:{table}:id — a fresh prefix beside emq:, the table name hashtagged so every key of one cache lands on one slot when clustering arrives. The id in the key’s value position is checked for shape before any key is composed, so a malformed name never reaches the wire.

The directory is alive. It monitors each table it registers, so a crashed cache leaves the roster the moment it leaves the node, and the enumeration is never stale. A cache, in BCS, is a declared component with a boundary and an owner, registered and watched — not a map someone reached for. It is the discipline the law applies to systems, applied to the things that make them fast.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related