StateViewCaches
The state view caches of a service, one CoCache cache per aggregate type, each holding that type's states as the view StateView marks, each at the aggregate's version: what a StateViewCache reads, and what the owner's StateViewWriter writes after each commit.
Everything about a cache follows from its view, the same on the owner and on every reader (specOf):
its name is
wow.<context>.<aggregate>(nameOf), the aggregate the view's@StateViewnames;its key is the aggregate's StateKey, stored as
<tenantId>/<id>;its value is the view, stored as its JSON (StateViewCodec), at the aggregate's version: a versioned cache, so a state is written only over an older one, and a deleted aggregate is a tombstone at its version that no older state undoes;
a miss is read from the owner through the node's typed queries (queries): in process when the node serves the aggregate, else over HTTP as this service, the queries pinned to the key's tenant; a batch read is one query per tenant, its ids in one
IN. The fill holds CoCache's lease, which the owner's write takes over: a fill never puts back a state older than the owner's. An aggregate never created is cached as absent (CoCache's negative cache).no early refresh (
refreshWindow = off()): the owner writes every version after its commit, so a refresh would only read the owner again, over HTTP on a reader. The declaration keeps CoCache's globalcocache.defaults.cache.refresh-windowoff these caches;cocache.caches.[wow.<context>.<aggregate>].refresh-windowstill turns it on for one.
Each cache is created once, by factory: CoCache's starter's (its CoCacheFactory bean), which applies the application's CoCache settings to it (cocache.defaults.cache.*, cocache.overrides.cache.*, cocache.caches.[wow.<context>.<aggregate>].*), else one on the runtime alone, which applies none.
Functions
Creates the caches of viewTypes now: CoCache's starter checks its settings against the caches it knows.