A Zanzibar server is a cache over Spanner, and a write to Spanner leaves the cached entry as it is.
A middleware that stores its data only in the database is stateless. A Zanzibar server also stores data locally, in a cache, so it holds state.
When a write arrives, Spanner is updated. The cache could evict the entry eagerly. The lesson assumes a simple way of operating in which it does not:
- The write. It flows through to the database. Spanner holds the new entry at 101 and the cache keeps the old entry.
- The read. A read operation sends a zookie, or names the previous write.
- The refresh. When a read asks for a value with a greater timestamp than the cached one, the cache updates itself.
Write operations never update the cache. Only read operations fetch the latest value, and the freshness value is there for that.
Zanzibar is a read heavy system. An order of magnitude is 10 times, and it has a hundred times as many read operations as writes.