jonnify·bcs /bcs/elixir-core/property-stores/ttl-as-structure

B2.2.3 · dive 3 of 3 · module B2.2

TTL as structure, not bookkeeping.

A bucket derived from the snowflake groups entries into time windows, so expiry drops whole buckets — O(buckets), touching no entry. The id carrying its time makes TTL structural.

Entries grouped into time buckets from the id; expiry drops whole buckets. Select a part.
bucket = snowflake >>> shift bucket t-2dropped whole bucket t-1bucket t expire_older_than: drops buckets, touches no entry
readout · Select a part. A right shift of the snowflake derives a bucket; expire_older_than drops whole buckets; anything minted-less-than-X-ago pays nothing per entry for TTL.
§1

The idea

echo_data · buckets.ex

Expiry is usually per-entry bookkeeping — a stored deadline on every row, a sweep that visits them. EchoData.Buckets removes the bookkeeping by deriving a bucket straight from the snowflake: a right shift of the id groups entries into fixed time windows, so dropping everything older than a cutoff is dropping whole buckets — an operation in the number of buckets, touching no individual entry.

The id carrying its own creation time is what makes this structural. The bucket of any id is computable, never searched for, so a fetch is a couple of map hops and an expiry is a handful of bucket deletions. Sessions, presence, rate-limit windows, ephemeral caches — anything whose lifetime is minted-less-than-X-ago — pays nothing per entry for its TTL.

Codemojex leans on this for everything short-lived. Presence and rate-limit windows live in buckets and age out by the shift; a finished round’s ephemeral state is dropped a bucket at a time, not row by row. Because the id already encodes when it was made, time-to-live stops being data the system maintains and becomes a property of where the entry sits.

§4

The doors

the sibling courses
§2

References

sources · related

Sources

Related