v0.1.15
Release 0.1.15
Ship the bus the generated config asks for, and bound the memory store
ream configure @c9up/echo wrote a config/cache.ts calling
drivers.redisBus({ connection: 'main' }), which this package did not
export: the very first thing an application did after installing echo left
it with a config that would not load. The same file passed
drivers.memory({ maxItems: 1000 }), an option the driver did not have,
so the file did not typecheck either.
Neither is fixed by editing the generated file, because both name the
right thing. A two-layer store without a bus is wrong the moment a second
instance exists: each process keeps serving its own L1 copy of a key
another has already deleted, and nothing tells it. So redisBus is now
real — Redis pub/sub through quasar, loaded on first use like
drivers.redis, on quasar's own subscriber socket because a subscribed
Redis client accepts nothing else. subscribe does not throw when the bus
is unreachable: a bus that is down costs staleness, and throwing there
would cost every cache read.
And maxItems bounds the memory store by COUNT, which a TTL cannot. Kept
by TTL alone, a cache keyed by a user id or a search term grows until the
process runs out of memory however short each entry's life. Expired
entries are evicted first — dropping a live one while a dead one sits in
the map would throw away a value someone still wants.
The generated file is now checked against the package: the names it
reaches for are read out of the source and looked up, so a config that
calls something echo does not export fails here rather than at a user's.
Changes since v0.1.14.