Skip to content

Learn that something cached has changed, and decide what the core listens to #116

Description

@iderex

The cache contract in #6 names three ways an entry stops being trusted: an
explicit invalidation, a change the server reports, and the passage of time. Time
is #43. Explicit invalidation is a call a caller makes. The middle one has no
issue, and it is the one that decides whether somebody who adds a film from a
laptop sees it on the television without restarting anything, and whether a
person who marks something watched on a phone sees it watched on the television
in the next room.

Left undecided, it gets decided by the first cache read somebody writes, which
will refetch everything or nothing depending on the day.

What this produces

The choice, with the two it did not take written down beside it and what each
costs.

Revalidating on the next read is cheapest and refreshes only what somebody
already asked for, which means the tile wall stays stale until it is scrolled.
Polling is predictable and is wrong on almost every run it makes, and its cost
lands on a server that may be a small machine in somebody's house. Listening to
whatever the server offers for this, named in the surface record in #10, means a
change arrives without being asked for, and it costs a connection held open, a
reconnection policy, and correct behaviour when that connection is dead without
having said so, which is the failure mode that looks exactly like a quiet
library.

Whichever is chosen, the rule per kind of entry rather than one rule for
everything, because a playback position and a library list do not need the same
answer and paying the expensive answer for both is how the cheap one gets
abandoned.

The degradation. When the mechanism fails, entries fall back to the time rule in
#43 rather than staying trusted, so a broken listener produces stale data that
knows it is stale rather than a cache that is confidently wrong forever.

Done when

The choice and the cost of the two alternatives are recorded, each kind of entry
names which rule it is under, a test makes a change on the fake server and proves
a cached read reflects it within the stated bound, and a test breaks the
mechanism without closing it cleanly and proves the affected entries fall back to
the time rule rather than remaining trusted. Blocked on #6, #10 and #43.

Metadata

Metadata

Assignees

Labels

architectureShape of the core: boundaries, interfaces, contractsperformanceThe speed budget and what measures it

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions