@radicaltools/mcp 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/{chunk-Z7THA3L5.js → chunk-2SZDTOYJ.js} +65 -33
  2. package/dist/{elkLayout-TAUBPPVN.js → elkLayout-VYJDCCIT.js} +1 -1
  3. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  4. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  5. package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
  6. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  7. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  8. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  9. package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
  10. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  11. package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
  12. package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
  13. package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
  14. package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
  15. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
  16. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  17. package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
  18. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  19. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  20. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  21. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  22. package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
  23. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  24. package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
  25. package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
  26. package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
  27. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  28. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  29. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  30. package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
  31. package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
  32. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  33. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  34. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
  35. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  36. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
  37. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
  38. package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
  39. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
  40. package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
  41. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  42. package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
  43. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  44. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
  45. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  46. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  47. package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
  48. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  49. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  50. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  51. package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
  52. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  53. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  54. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
  55. package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
  56. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  57. package/dist/index.js +1001 -230
  58. package/package.json +1 -1
@@ -0,0 +1,1294 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-caching",
4
+ "category": "concern",
5
+ "name": "Caching",
6
+ "description": "Where reads of a data store are cached (at the HTTP edge, in a shared Redis or Valkey, in each instance, or not at all), how long entries live and how a change removes them, how a miss storm is prevented, and what happens when the cache is down. Where reads are served from and how stale they may be is decided in the Data consistency pack. The snippets are for a Node service with Vitest, Testcontainers, dependency-cruiser, k6 and Prometheus; each tool line names the JVM equivalent.",
7
+ "tags": [
8
+ "caching",
9
+ "performance",
10
+ "http caching",
11
+ "redis",
12
+ "cache invalidation",
13
+ "cache stampede"
14
+ ],
15
+ "requiredMetamodel": "c4-ddd-governance-builtin",
16
+ "concern": {
17
+ "id": "caching",
18
+ "trigger": "LIST RELATIONS WHERE (source.type = \"container\" OR source.type = \"component\") AND source.external != true AND target.type = \"database\"",
19
+ "applyTo": "source",
20
+ "why": "these elements read a data store, so whether and where its data is cached, how stale a reader may see it, and what happens when the cache misses or fails has to be decided.",
21
+ "group": "architecture"
22
+ },
23
+ "sources": [
24
+ {
25
+ "title": "RFC 9111, HTTP Caching",
26
+ "url": "https://www.rfc-editor.org/rfc/rfc9111"
27
+ },
28
+ {
29
+ "title": "RFC 9110, HTTP Semantics (validators, conditional requests)",
30
+ "url": "https://www.rfc-editor.org/rfc/rfc9110"
31
+ },
32
+ {
33
+ "title": "RFC 5861, HTTP Cache-Control Extensions for Stale Content",
34
+ "url": "https://www.rfc-editor.org/rfc/rfc5861"
35
+ },
36
+ {
37
+ "title": "Amazon Builders' Library: Caching challenges and strategies",
38
+ "url": "https://aws.amazon.com/builders-library/caching-challenges-and-strategies/"
39
+ },
40
+ {
41
+ "title": "Amazon ElastiCache: Caching strategies (lazy loading, write-through, TTL)",
42
+ "url": "https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/Strategies.html"
43
+ },
44
+ {
45
+ "title": "Redis documentation: Key eviction",
46
+ "url": "https://redis.io/docs/latest/develop/reference/eviction/"
47
+ },
48
+ {
49
+ "title": "Caffeine wiki",
50
+ "url": "https://github.com/ben-manes/caffeine/wiki"
51
+ },
52
+ {
53
+ "title": "Vattani, Chierichetti, Lowenstein: Optimal Probabilistic Cache Stampede Prevention (PVLDB 8(8), 2015)",
54
+ "url": "https://www.vldb.org/pvldb/vol8/p886-vattani.pdf"
55
+ },
56
+ {
57
+ "title": "Nishtala et al.: Scaling Memcache at Facebook (NSDI 2013)",
58
+ "url": "https://www.usenix.org/conference/nsdi13/technical-sessions/presentation/nishtala"
59
+ }
60
+ ],
61
+ "templateParams": [
62
+ {
63
+ "key": "WHERE",
64
+ "title": "Where",
65
+ "label": "Where is data read from the store cached?",
66
+ "hint": "Each place caches different things: the edge only responses that are the same for every caller, a shared cache anything at the cost of a store to run, an in-process cache anything at the cost of one copy per instance. Replicas and read models are decided in the Data consistency pack, not here.",
67
+ "defaultValue": "none",
68
+ "options": [
69
+ {
70
+ "value": "edge",
71
+ "label": "HTTP caching at the edge (Cache-Control and ETag)",
72
+ "description": "The element marks its responses with Cache-Control and ETag (RFC 9111) and a CDN in front of it, and the browsers, keep them; a hit never reaches the element. Pick it when the responses read most are the same for every caller: catalogues, prices, public content."
73
+ },
74
+ {
75
+ "value": "shared",
76
+ "label": "a shared cache (Redis or Valkey) with cache-aside",
77
+ "description": "Every instance looks in one Redis or Valkey first and, on a miss, reads the store and puts the entry there with an expiry. Pick it when reads differ per caller or per query, several instances serve them, and the store or its latency is the bottleneck."
78
+ },
79
+ {
80
+ "value": "local",
81
+ "label": "an in-process cache in each instance",
82
+ "description": "Each instance keeps a size-bounded cache in its own memory: Caffeine on the JVM, lru-cache in Node.js. Pick it for small, hot, slowly changing data (reference data, configuration, feature lists) where a network hop matters and instances may disagree for a few seconds."
83
+ },
84
+ {
85
+ "value": "none",
86
+ "label": "no cache",
87
+ "description": "Every read goes to the store; nothing keeps copies of its data between requests. Pick it while the store meets the latency budget and carries the reads, which is longer than most expect; the decision records it so a cache does not arrive without one."
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ "key": "INVALIDATION",
93
+ "title": "Invalidation",
94
+ "label": "How does a change leave the cache?",
95
+ "hint": "Expiry alone bounds staleness by the TTL; removing entries on a change bounds it by seconds, if every write path does it. Where the Data consistency pack decides reads with bounded staleness, the TTL (TTL_SECONDS) must not exceed that pack's propagation bound (PROPAGATION_SECONDS). Only with a cache (not with no cache).",
96
+ "defaultValue": "delete",
97
+ "options": [
98
+ {
99
+ "value": "ttl",
100
+ "label": "expiry alone (TTL)",
101
+ "description": "Entries expire after the TTL and nothing removes them earlier; a reader may see data as old as the TTL. Pick it when that much staleness is acceptable to the product (catalogues, reference data, counts) and writes come from many places you do not control. Not for an element whose Data consistency decision is reads from the primary only, which asks a cache to remove an entry when its data changes."
102
+ },
103
+ {
104
+ "value": "delete",
105
+ "label": "deletion by the writer after the commit",
106
+ "description": "The code that changes the data deletes the entries it made stale (or purges them from the CDN) right after its transaction commits; the TTL stays as the backstop. Pick it when the writes go through this element's own code."
107
+ },
108
+ {
109
+ "value": "event",
110
+ "label": "deletion by change events (outbox or change data capture)",
111
+ "description": "A consumer of the store's change events (the outbox events, or Debezium change data capture) deletes or purges the entries each change made stale; the TTL stays as the backstop. Pick it when other services, jobs or migrations write the same data, or a deletion lost to a crash is not acceptable."
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ "key": "STAMPEDE",
117
+ "title": "Miss storms",
118
+ "label": "What keeps many concurrent misses for one key from all reading the store?",
119
+ "hint": "When a hot entry expires, every request that misses at once reads the store, which slows every one of them down. Only with a shared or in-process cache: at the edge, the CDN's request collapsing does this and is named in the decision.",
120
+ "defaultValue": "coalesce",
121
+ "options": [
122
+ {
123
+ "value": "coalesce",
124
+ "label": "request coalescing (one load per key at a time)",
125
+ "description": "The first miss for a key loads it; concurrent misses for the same key wait for that load instead of reading the store themselves (single flight). Pick it by default: it bounds store reads per key to one per instance at any moment."
126
+ },
127
+ {
128
+ "value": "early",
129
+ "label": "probabilistic early refresh (XFetch)",
130
+ "description": "A read close to an entry's expiry refreshes it early with a probability that grows as expiry nears, so one request reloads a hot entry before it expires. Pick it for a few very hot entries that are expensive to load, where even one wave of waiting requests is too slow."
131
+ },
132
+ {
133
+ "value": "none",
134
+ "label": "no protection; the store takes every miss",
135
+ "description": "Concurrent misses each read the store. Pick it only when the store carries the peak read load with an empty cache, which a load test proves; the decision records it."
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ "key": "DOWN",
141
+ "title": "Cache down",
142
+ "label": "What happens to reads while the shared cache is down?",
143
+ "hint": "A store sized for the traffic the cache lets through cannot take every read at once. Only with a shared cache: an in-process cache fails with its instance, and the CDN's availability is the Infrastructure pack's.",
144
+ "defaultValue": "store",
145
+ "options": [
146
+ {
147
+ "value": "store",
148
+ "label": "reads from the store behind a circuit breaker and a concurrency limit",
149
+ "description": "Reads go to the store, a circuit breaker stops trying the cache until it answers again, and each instance runs only a limited number of store reads at once, refusing the rest with 503. Pick it when the store can carry part of the read load and a slower, partial service is better than none."
150
+ },
151
+ {
152
+ "value": "fail",
153
+ "label": "a fast refusal (503 with Retry-After)",
154
+ "description": "Reads that need the cache are refused at once as temporary, and the store is not read. Pick it when the store cannot carry the reads without the cache and must be kept free for writes, or when the cache is the only copy fast enough to be useful."
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "key": "TTL_SECONDS",
160
+ "label": "How long may a cached entry or response live (seconds)? The oldest data a reader can be served",
161
+ "defaultValue": "60",
162
+ "type": "number"
163
+ },
164
+ {
165
+ "key": "INVALIDATE_SECONDS",
166
+ "label": "Within how many seconds of a commit must a changed entry be gone from every cache? (deletion by the writer or by change events)",
167
+ "defaultValue": "5",
168
+ "type": "number"
169
+ },
170
+ {
171
+ "key": "HIT_RATIO",
172
+ "label": "What share of lookups must the cache answer (%)? (shared or in-process cache)",
173
+ "defaultValue": "80",
174
+ "type": "number"
175
+ },
176
+ {
177
+ "key": "LOCAL_MAX_ENTRIES",
178
+ "label": "How many entries may each instance's cache hold at most? (in-process cache)",
179
+ "defaultValue": "10000",
180
+ "type": "number"
181
+ },
182
+ {
183
+ "key": "CACHE_TIMEOUT_MS",
184
+ "label": "After how many milliseconds does a call to the shared cache give up? (shared cache)",
185
+ "defaultValue": "50",
186
+ "type": "number"
187
+ },
188
+ {
189
+ "key": "FALLBACK_CONCURRENCY",
190
+ "label": "With the shared cache down, how many store reads may each instance run at once? (reads from the store)",
191
+ "defaultValue": "20",
192
+ "type": "number"
193
+ }
194
+ ]
195
+ },
196
+ "nodes": [
197
+ {
198
+ "id": "need",
199
+ "type": "need",
200
+ "label": "Reads fast without serving wrong data",
201
+ "x": 0,
202
+ "y": 0,
203
+ "kind": "brief",
204
+ "source": "Hub concern pack: Caching",
205
+ "description": "The element reads the same data from its store again and again, and the store's latency and capacity limit how fast and how many reads it can serve. Reads have to stay fast under load, yet a reader must not see data older than a stated bound, no write may be decided on a stale copy, no response meant for one caller may reach another, and neither an expired hot entry nor a cache outage may take the store down. The snippets assume the application under src/ (src/app exports the app, the router's table and createApp, src/http/cachePolicy the Cache-Control per route and the set of personal routes, src/cache/read the cached reads, src/cache/invalidate the removal after a write, src/cache/local and src/cache/xfetch the in-process cache and the early refresh, src/commands the operations that change data, src/catalog/store the store reads) and the tests under tests/ with their fixtures in tests/cache."
206
+ },
207
+ {
208
+ "id": "req-cache-control",
209
+ "type": "requirement",
210
+ "label": "Every response says how it may be cached",
211
+ "x": 260,
212
+ "y": 0,
213
+ "ears_type": "ubiquitous",
214
+ "action": "send an explicit Cache-Control header with every response to a GET request, mark every response that carries personal data or depends on who is calling private or no-store, and give every response a shared cache may store an ETag and a lifetime (s-maxage or max-age, plus any stale-while-revalidate) of at most {{TTL_SECONDS}} seconds",
215
+ "rationale": "Without Cache-Control a cache may choose a lifetime of its own (RFC 9111 4.2.2, heuristic freshness); a shared cache that stores a response meant for one caller hands it to the next, which private and no-store forbid (RFC 9111 3.5, 5.2.2.5, 5.2.2.7)."
216
+ },
217
+ {
218
+ "id": "req-no-cache",
219
+ "type": "requirement",
220
+ "label": "Reads go to the store",
221
+ "x": 260,
222
+ "y": 130,
223
+ "ears_type": "ubiquitous",
224
+ "action": "read the data it serves from the store on every request and keep no copy of the store's data between requests, in its own memory or in another store",
225
+ "rationale": "A cache is a second copy with its own staleness, failure mode and cold start, and services come to depend on it without noticing (Amazon Builders' Library, Caching challenges and strategies); while the store meets the latency budget, not having one is the simpler design.",
226
+ "hubWhen": {
227
+ "WHERE": [
228
+ "none"
229
+ ]
230
+ }
231
+ },
232
+ {
233
+ "id": "req-expiry",
234
+ "type": "requirement",
235
+ "label": "Every entry expires",
236
+ "x": 260,
237
+ "y": 260,
238
+ "ears_type": "ubiquitous",
239
+ "action": "store every cached entry and every response a shared cache may keep with an expiry of at most {{TTL_SECONDS}} seconds, so that no reader is served data older than that even when a removal is lost",
240
+ "rationale": "Expiry is the backstop that bounds staleness whatever else fails, and the TTL is chosen by how stale a reader may see the data (Amazon Builders' Library; ElastiCache caching strategies, adding TTL).",
241
+ "hubWhen": {
242
+ "WHERE": [
243
+ "edge",
244
+ "shared",
245
+ "local"
246
+ ]
247
+ }
248
+ },
249
+ {
250
+ "id": "req-invalidate",
251
+ "type": "requirement",
252
+ "label": "A change leaves the cache",
253
+ "x": 260,
254
+ "y": 390,
255
+ "ears_type": "event-driven",
256
+ "trigger": "a transaction that changes cached data commits",
257
+ "action": "remove the entries it made stale from every cache that holds them (the shared cache, the cache of every instance, or the CDN) within {{INVALIDATE_SECONDS}} seconds, deleting them rather than writing the new value",
258
+ "rationale": "Without removal on a change, readers see old data until the TTL; a delete is idempotent and cannot leave an older value behind, as two concurrent overwrites can (Nishtala et al., Scaling Memcache at Facebook, section 2).",
259
+ "hubWhen": {
260
+ "WHERE": [
261
+ "edge",
262
+ "shared",
263
+ "local"
264
+ ],
265
+ "INVALIDATION": [
266
+ "delete",
267
+ "event"
268
+ ]
269
+ }
270
+ },
271
+ {
272
+ "id": "req-writes-bypass",
273
+ "type": "requirement",
274
+ "label": "Writes decide on the store",
275
+ "x": 260,
276
+ "y": 520,
277
+ "ears_type": "ubiquitous",
278
+ "action": "take every decision that writes (a stock check before a reservation, a price at checkout, a permission check) on data read from the store inside the writing transaction, never on a cached entry",
279
+ "rationale": "A cached entry may be up to the TTL old by design; a write decided on it is a lost update (Amazon Builders' Library, on cache consistency). The Data consistency pack takes the same rule for replicas.",
280
+ "hubWhen": {
281
+ "WHERE": [
282
+ "shared",
283
+ "local"
284
+ ]
285
+ }
286
+ },
287
+ {
288
+ "id": "req-coalesce",
289
+ "type": "requirement",
290
+ "label": "One load per key at a time",
291
+ "x": 260,
292
+ "y": 650,
293
+ "ears_type": "event-driven",
294
+ "trigger": "several requests miss the cache for the same key at the same time",
295
+ "action": "read the store for that key once per instance, and give the other requests the result of that read",
296
+ "rationale": "When a hot entry expires, every concurrent request recomputes it and each recomputation slows the others (Vattani et al.); coalescing allows one pending load per key (Amazon Builders' Library, request coalescing; Caffeine wiki, Population: an atomic get with a mapping function).",
297
+ "hubWhen": {
298
+ "WHERE": [
299
+ "shared",
300
+ "local"
301
+ ],
302
+ "STAMPEDE": [
303
+ "coalesce"
304
+ ]
305
+ }
306
+ },
307
+ {
308
+ "id": "req-early",
309
+ "type": "requirement",
310
+ "label": "Hot entries refreshed before they expire",
311
+ "x": 260,
312
+ "y": 780,
313
+ "ears_type": "event-driven",
314
+ "trigger": "a request reads an entry close to its expiry",
315
+ "action": "refresh the entry before it expires with a probability that rises as expiry nears, scaled by how long its last load took (XFetch with beta 1), and serve the cached value meanwhile",
316
+ "rationale": "Probabilistic early expiration lets one request reload a hot entry just before it expires, so the many that follow find it fresh; the exponential form (XFetch) is optimal and needs no tuning at beta 1 (Vattani et al., sections 4 and 5).",
317
+ "hubWhen": {
318
+ "WHERE": [
319
+ "shared",
320
+ "local"
321
+ ],
322
+ "STAMPEDE": [
323
+ "early"
324
+ ]
325
+ }
326
+ },
327
+ {
328
+ "id": "req-cold",
329
+ "type": "requirement",
330
+ "label": "The store carries a cold cache",
331
+ "x": 260,
332
+ "y": 910,
333
+ "ears_type": "state-driven",
334
+ "precondition": "the cache is empty, after a deploy, a flush or a failover",
335
+ "action": "serve the peak read load set in the Capacity and scaling pack from the store alone, with fewer than 0.1 % errors and within that pack's latency budget",
336
+ "rationale": "Without protection every miss reaches the store; a store sized for the traffic a warm cache lets through browns out when the cache is cold (Amazon Builders' Library, cold start and thundering herd).",
337
+ "hubWhen": {
338
+ "WHERE": [
339
+ "shared",
340
+ "local"
341
+ ],
342
+ "STAMPEDE": [
343
+ "none"
344
+ ]
345
+ }
346
+ },
347
+ {
348
+ "id": "req-down-store",
349
+ "type": "requirement",
350
+ "label": "Cache outage falls back, limited",
351
+ "x": 260,
352
+ "y": 1040,
353
+ "ears_type": "unwanted-behaviour",
354
+ "unwanted_condition": "the shared cache does not answer within {{CACHE_TIMEOUT_MS}} ms or refuses connections",
355
+ "action": "serve reads from the store, stop calling the cache through a circuit breaker until it answers again, and run at most {{FALLBACK_CONCURRENCY}} store reads at once per instance, refusing the excess with 503 and a Retry-After header",
356
+ "rationale": "Falling back to the store when the cache fails sends it the whole read load at once and can brown it out; cap the rate of calls to it and shed the rest (Amazon Builders' Library, cache downtime).",
357
+ "hubWhen": {
358
+ "WHERE": [
359
+ "shared"
360
+ ],
361
+ "DOWN": [
362
+ "store"
363
+ ]
364
+ }
365
+ },
366
+ {
367
+ "id": "req-down-fail",
368
+ "type": "requirement",
369
+ "label": "Cache outage refused fast",
370
+ "x": 260,
371
+ "y": 1170,
372
+ "ears_type": "unwanted-behaviour",
373
+ "unwanted_condition": "the shared cache does not answer within {{CACHE_TIMEOUT_MS}} ms or refuses connections",
374
+ "action": "refuse the reads that need it with 503 and a Retry-After header within {{CACHE_TIMEOUT_MS}} ms plus 100 ms, without reading the store",
375
+ "rationale": "When the store cannot carry the reads without the cache, a fast refusal keeps it free for writes and for the moment the cache returns (Amazon Builders' Library, cache downtime and load shedding).",
376
+ "hubWhen": {
377
+ "WHERE": [
378
+ "shared"
379
+ ],
380
+ "DOWN": [
381
+ "fail"
382
+ ]
383
+ }
384
+ },
385
+ {
386
+ "id": "req-local-bound",
387
+ "type": "requirement",
388
+ "label": "In-process cache bounded",
389
+ "x": 260,
390
+ "y": 1300,
391
+ "ears_type": "ubiquitous",
392
+ "action": "hold at most {{LOCAL_MAX_ENTRIES}} entries in each instance's cache, evicting the least recently or least frequently used when it is full",
393
+ "rationale": "An unbounded in-process cache grows with the key space until the instance runs out of memory; size-based eviction keeps the hit ratio high in bounded memory (Caffeine wiki, Eviction and Efficiency).",
394
+ "hubWhen": {
395
+ "WHERE": [
396
+ "local"
397
+ ]
398
+ }
399
+ },
400
+ {
401
+ "id": "req-shared-own",
402
+ "type": "requirement",
403
+ "label": "The cache has a Redis of its own",
404
+ "x": 260,
405
+ "y": 1430,
406
+ "ears_type": "ubiquitous",
407
+ "action": "keep cached entries in a Redis or Valkey instance used only as this cache, with maxmemory set and the allkeys-lru or allkeys-lfu eviction policy",
408
+ "rationale": "A cache may lose any entry, while idempotency keys, sessions and rate-limit counters must not be evicted; Redis advises a separate instance over mixing them under a volatile policy, and maxmemory 0 means no limit at all (Redis documentation, Key eviction).",
409
+ "hubWhen": {
410
+ "WHERE": [
411
+ "shared"
412
+ ]
413
+ }
414
+ },
415
+ {
416
+ "id": "req-hit-ratio",
417
+ "type": "requirement",
418
+ "label": "The cache earns its place",
419
+ "x": 260,
420
+ "y": 1560,
421
+ "ears_type": "ubiquitous",
422
+ "action": "answer at least {{HIT_RATIO}} % of cache lookups from the cache over each hour of traffic, and alert the team when it falls below",
423
+ "rationale": "A cache that misses most lookups adds a hop and a second copy for nothing; a falling ratio is the first sign of a wrong TTL, key or eviction policy (Redis documentation, Key eviction: keyspace_hits and keyspace_misses).",
424
+ "hubWhen": {
425
+ "WHERE": [
426
+ "shared",
427
+ "local"
428
+ ]
429
+ }
430
+ },
431
+ {
432
+ "id": "req-conditional",
433
+ "type": "requirement",
434
+ "label": "Unchanged responses revalidate cheaply",
435
+ "x": 260,
436
+ "y": 1690,
437
+ "ears_type": "event-driven",
438
+ "trigger": "a GET request carries an If-None-Match header that matches the current ETag of a response a shared cache may keep",
439
+ "action": "answer 304 Not Modified without a body",
440
+ "rationale": "Revalidation turns an expired entry into a small 304 instead of a full response, so a short TTL costs little (RFC 9111 4.3; RFC 9110 13.1.2 and 15.4.5).",
441
+ "hubWhen": {
442
+ "WHERE": [
443
+ "edge"
444
+ ]
445
+ }
446
+ },
447
+ {
448
+ "id": "sc-cache-control",
449
+ "type": "scenario",
450
+ "label": "Cache headers per route",
451
+ "x": 520,
452
+ "y": 0,
453
+ "given": "every GET route of the element",
454
+ "when": "each is called as a signed-in user",
455
+ "then": "every response carries Cache-Control, those with personal data are private or no-store, and those a shared cache may keep carry an ETag and a lifetime of at most {{TTL_SECONDS}} seconds"
456
+ },
457
+ {
458
+ "id": "sc-no-cache",
459
+ "type": "scenario",
460
+ "label": "No cache library",
461
+ "x": 520,
462
+ "y": 130,
463
+ "given": "the element's source code",
464
+ "when": "the dependency rules run",
465
+ "then": "no module under src imports a cache client or an in-process cache library, apart from the modules other decisions give a Redis of their own",
466
+ "hubWhen": {
467
+ "WHERE": [
468
+ "none"
469
+ ]
470
+ }
471
+ },
472
+ {
473
+ "id": "sc-expiry",
474
+ "type": "scenario",
475
+ "label": "No entry outlives the TTL",
476
+ "x": 520,
477
+ "y": 260,
478
+ "given": "the cache after a day of normal traffic",
479
+ "when": "its entries, or the headers of the responses a shared cache may keep, are read",
480
+ "then": "every one expires within {{TTL_SECONDS}} seconds",
481
+ "hubWhen": {
482
+ "WHERE": [
483
+ "edge",
484
+ "shared",
485
+ "local"
486
+ ]
487
+ }
488
+ },
489
+ {
490
+ "id": "sc-invalidate",
491
+ "type": "scenario",
492
+ "label": "Change reaches every reader",
493
+ "x": 520,
494
+ "y": 390,
495
+ "given": "a product whose price is cached in every instance (or at the CDN)",
496
+ "when": "its price is changed",
497
+ "then": "every reader gets the new price within {{INVALIDATE_SECONDS}} seconds",
498
+ "hubWhen": {
499
+ "WHERE": [
500
+ "edge",
501
+ "shared",
502
+ "local"
503
+ ],
504
+ "INVALIDATION": [
505
+ "delete",
506
+ "event"
507
+ ]
508
+ }
509
+ },
510
+ {
511
+ "id": "sc-writes-bypass",
512
+ "type": "scenario",
513
+ "label": "Commands do not read the cache",
514
+ "x": 520,
515
+ "y": 520,
516
+ "given": "the operations that change data, under src/commands",
517
+ "when": "the dependency rules run",
518
+ "then": "none of them reaches the cached reads, directly or through other modules",
519
+ "hubWhen": {
520
+ "WHERE": [
521
+ "shared",
522
+ "local"
523
+ ]
524
+ }
525
+ },
526
+ {
527
+ "id": "sc-coalesce",
528
+ "type": "scenario",
529
+ "label": "Hundred misses, one read",
530
+ "x": 520,
531
+ "y": 650,
532
+ "given": "a key that is not in the cache",
533
+ "when": "100 requests for it arrive at once on one instance",
534
+ "then": "the store is read once and all 100 requests get the same value",
535
+ "hubWhen": {
536
+ "WHERE": [
537
+ "shared",
538
+ "local"
539
+ ],
540
+ "STAMPEDE": [
541
+ "coalesce"
542
+ ]
543
+ }
544
+ },
545
+ {
546
+ "id": "sc-early",
547
+ "type": "scenario",
548
+ "label": "Refresh just in time",
549
+ "x": 520,
550
+ "y": 780,
551
+ "given": "an entry read every millisecond whose last load took 50 ms",
552
+ "when": "its expiry approaches",
553
+ "then": "a read refreshes it before it expires, and less than 1 second before",
554
+ "hubWhen": {
555
+ "WHERE": [
556
+ "shared",
557
+ "local"
558
+ ],
559
+ "STAMPEDE": [
560
+ "early"
561
+ ]
562
+ }
563
+ },
564
+ {
565
+ "id": "sc-cold",
566
+ "type": "scenario",
567
+ "label": "Peak on an empty cache",
568
+ "x": 520,
569
+ "y": 910,
570
+ "given": "an emptied cache",
571
+ "when": "the peak read rate on 20 hot keys runs for 5 minutes",
572
+ "then": "errors stay under 0.1 % and the 95th percentile within the latency budget",
573
+ "hubWhen": {
574
+ "WHERE": [
575
+ "shared",
576
+ "local"
577
+ ],
578
+ "STAMPEDE": [
579
+ "none"
580
+ ]
581
+ }
582
+ },
583
+ {
584
+ "id": "sc-down-store",
585
+ "type": "scenario",
586
+ "label": "Cache stopped, store protected",
587
+ "x": 520,
588
+ "y": 1040,
589
+ "given": "a warm shared cache",
590
+ "when": "the cache is stopped and 200 reads arrive at once",
591
+ "then": "each read answers 200 or 503 with Retry-After, some answer 200, and the store never runs more than {{FALLBACK_CONCURRENCY}} reads at once",
592
+ "hubWhen": {
593
+ "WHERE": [
594
+ "shared"
595
+ ],
596
+ "DOWN": [
597
+ "store"
598
+ ]
599
+ }
600
+ },
601
+ {
602
+ "id": "sc-down-fail",
603
+ "type": "scenario",
604
+ "label": "Cache stopped, reads refused",
605
+ "x": 520,
606
+ "y": 1170,
607
+ "given": "a warm shared cache",
608
+ "when": "the cache is stopped and a read arrives",
609
+ "then": "it is refused with 503 and Retry-After within {{CACHE_TIMEOUT_MS}} ms plus 100 ms, and the store receives no read",
610
+ "hubWhen": {
611
+ "WHERE": [
612
+ "shared"
613
+ ],
614
+ "DOWN": [
615
+ "fail"
616
+ ]
617
+ }
618
+ },
619
+ {
620
+ "id": "sc-local-bound",
621
+ "type": "scenario",
622
+ "label": "Cache stays in its bound",
623
+ "x": 520,
624
+ "y": 1300,
625
+ "given": "an instance's cache",
626
+ "when": "1,000 more keys than the bound are loaded into it",
627
+ "then": "it holds at most {{LOCAL_MAX_ENTRIES}} entries",
628
+ "hubWhen": {
629
+ "WHERE": [
630
+ "local"
631
+ ]
632
+ }
633
+ },
634
+ {
635
+ "id": "sc-shared-own",
636
+ "type": "scenario",
637
+ "label": "Cache Redis configured",
638
+ "x": 520,
639
+ "y": 1430,
640
+ "given": "the cache's Redis or Valkey",
641
+ "when": "its memory settings are read",
642
+ "then": "maxmemory is above 0 and the eviction policy is allkeys-lru or allkeys-lfu",
643
+ "hubWhen": {
644
+ "WHERE": [
645
+ "shared"
646
+ ]
647
+ }
648
+ },
649
+ {
650
+ "id": "sc-hit-ratio",
651
+ "type": "scenario",
652
+ "label": "Low hit ratio alerts",
653
+ "x": 520,
654
+ "y": 1560,
655
+ "given": "the cache's hit and miss counters",
656
+ "when": "the hit ratio over an hour stays below {{HIT_RATIO}} % for 15 minutes",
657
+ "then": "an alert opens a ticket for the team",
658
+ "hubWhen": {
659
+ "WHERE": [
660
+ "shared",
661
+ "local"
662
+ ]
663
+ }
664
+ },
665
+ {
666
+ "id": "sc-conditional",
667
+ "type": "scenario",
668
+ "label": "Expired entry revalidated",
669
+ "x": 520,
670
+ "y": 1690,
671
+ "given": "a response a shared cache keeps, with its ETag",
672
+ "when": "it is requested again with If-None-Match set to that ETag",
673
+ "then": "the answer is 304 without a body",
674
+ "hubWhen": {
675
+ "WHERE": [
676
+ "edge"
677
+ ]
678
+ }
679
+ },
680
+ {
681
+ "id": "adr-edge",
682
+ "type": "adr",
683
+ "label": "HTTP caching at the edge",
684
+ "x": 780,
685
+ "y": 0,
686
+ "concern": "caching",
687
+ "status": "accepted",
688
+ "date": "",
689
+ "context": "This element reads from a data store, and some of what it reads is read far more often than it changes. The forces: a cache cuts latency and load on the store, but every cached entry is a second copy that is wrong from the moment the data changes until it expires or is removed; a lost or late invalidation shows users old data, and a write decided on a cached value loses an update; when a hot entry expires, every request that misses at once goes to the store (a stampede); a cache creates two code paths, and a store sized for the traffic the cache lets through browns out when the cache is empty or down; and a response cached for everyone that was meant for one caller is a data leak. Where reads are served from (the primary, replicas, read models) and how stale they may be is decided in the Data consistency pack; the CDN hosting and the caching of a front end's static files in the Infrastructure and Frontend stack packs; the latency budget in the Capacity and scaling pack; whether personal data may sit in a cache, and how erasure reaches it, in the Personal data and Data classification packs; the tenant in every cache key in the Tenant isolation pack.",
690
+ "decision": "Responses that are the same for every caller are cached by the CDN in front of the element (Amazon CloudFront, Azure Front Door, Fastly or Cloudflare; where it runs is decided in the Infrastructure pack) and by browsers, following RFC 9111. The element sets the policy per route in one table in the code (src/http/cachePolicy): a shared response gets Cache-Control public with s-maxage, and any stale-while-revalidate (RFC 5861), adding up to at most {{TTL_SECONDS}} seconds, and an ETag, and a request whose If-None-Match matches is answered with 304; a response that carries personal data or depends on the caller gets private or no-store. The CDN's cache key is the path and the query parameters listed per route, never a cookie or the Authorization header. Concurrent misses for one object are collapsed by the CDN into one request to the element (CloudFront and Fastly request collapsing), with an origin shield where the CDN offers one. Invalidation: {{INVALIDATION}}; where entries are removed on a change, the removal goes through the CDN's purge API (CloudFront CreateInvalidation by path, Fastly purge by surrogate key, Cloudflare purge by cache tag), whose propagation counts against the bound. Static files of a front end are cached as the Frontend stack pack decides.",
691
+ "consequences": "• A hit never reaches the element or the store: the cheapest and fastest cache there is.\n• Only responses that are the same for every caller gain; personalised responses still reach the element on every request.\n• A mistake in the policy (a personal response marked public) shows one user's data to others: the policy table and its test are the control.\n• A purge is an API call with its own propagation time and, on some CDNs, a price per path.\n• The hit ratio is read in the CDN's own statistics, not in the element's metrics.",
692
+ "alternatives": "1. A shared application cache (Redis or Valkey): caches what differs per caller too, at the cost of a store to run.\n2. An in-process cache: no network hop, but one copy per instance.\n3. No cache: nothing to invalidate; every read reaches the store.",
693
+ "hubWhen": {
694
+ "WHERE": [
695
+ "edge"
696
+ ]
697
+ }
698
+ },
699
+ {
700
+ "id": "adr-shared",
701
+ "type": "adr",
702
+ "label": "A shared cache with cache-aside",
703
+ "x": 780,
704
+ "y": 130,
705
+ "concern": "caching",
706
+ "status": "accepted",
707
+ "date": "",
708
+ "context": "This element reads from a data store, and some of what it reads is read far more often than it changes. The forces: a cache cuts latency and load on the store, but every cached entry is a second copy that is wrong from the moment the data changes until it expires or is removed; a lost or late invalidation shows users old data, and a write decided on a cached value loses an update; when a hot entry expires, every request that misses at once goes to the store (a stampede); a cache creates two code paths, and a store sized for the traffic the cache lets through browns out when the cache is empty or down; and a response cached for everyone that was meant for one caller is a data leak. Where reads are served from (the primary, replicas, read models) and how stale they may be is decided in the Data consistency pack; the CDN hosting and the caching of a front end's static files in the Infrastructure and Frontend stack packs; the latency budget in the Capacity and scaling pack; whether personal data may sit in a cache, and how erasure reaches it, in the Personal data and Data classification packs; the tenant in every cache key in the Tenant isolation pack.",
709
+ "decision": "Data read from the store is cached in a Redis or Valkey used for nothing else (managed: Amazon ElastiCache, Azure Cache for Redis or Google Memorystore), with maxmemory set and the allkeys-lru eviction policy, separate from any Redis that keeps idempotency keys, sessions or rate-limit counters. Reads use cache-aside through src/cache/read: look in the cache, on a miss read the store and set the entry with an expiry of at most {{TTL_SECONDS}} seconds. Keys are cache:<entity>:<id>:v<schema version>, so a release that changes the cached shape starts on new keys. Calls to the cache give up after {{CACHE_TIMEOUT_MS}} ms (ioredis commandTimeout with the offline queue off; a Lettuce command timeout on the JVM). Invalidation: {{INVALIDATION}}; an entry removed on a change is deleted, never overwritten, and gone within {{INVALIDATE_SECONDS}} seconds of the commit. Concurrent misses for one key: {{STAMPEDE}}. With the cache down: {{DOWN}}; the circuit breaker is that of the library the Integration resilience pack chose (cockatiel, Resilience4j, Polly). Decisions that write read the store inside their transaction, never the cache. The staleness the TTL allows must fit the read decision of the Data consistency pack.",
710
+ "consequences": "• One miss warms the cache for every instance; a hit costs a network round trip, well under a millisecond within one zone.\n• A store to size, patch and watch; a managed service takes most of the work.\n• The cache is on the read path: its outage is designed for (falling back with a limit, or refusing fast), and a store sized only for the misses cannot take every read at once.\n• Every write path must remove what it changed, or readers see old data up to the TTL; deletion by change events also catches writers outside the element.\n• Two code paths, hit and miss: tests must run both, and a cold cache is tested on purpose.",
711
+ "alternatives": "1. An in-process cache: no hop and no store to run, but one copy per instance and invalidation in every instance.\n2. HTTP caching at the edge: no store, but only for responses that are the same for everyone.\n3. Read replicas (the Data consistency pack): more read capacity without a second copy to invalidate.\n4. Write-through, the writer setting the new value in the cache: entries are fresh, but two concurrent writers can leave the older value, and values nobody reads fill the cache (ElastiCache caching strategies; Nishtala et al.).",
712
+ "hubWhen": {
713
+ "WHERE": [
714
+ "shared"
715
+ ]
716
+ }
717
+ },
718
+ {
719
+ "id": "adr-local",
720
+ "type": "adr",
721
+ "label": "An in-process cache in each instance",
722
+ "x": 780,
723
+ "y": 260,
724
+ "concern": "caching",
725
+ "status": "accepted",
726
+ "date": "",
727
+ "context": "This element reads from a data store, and some of what it reads is read far more often than it changes. The forces: a cache cuts latency and load on the store, but every cached entry is a second copy that is wrong from the moment the data changes until it expires or is removed; a lost or late invalidation shows users old data, and a write decided on a cached value loses an update; when a hot entry expires, every request that misses at once goes to the store (a stampede); a cache creates two code paths, and a store sized for the traffic the cache lets through browns out when the cache is empty or down; and a response cached for everyone that was meant for one caller is a data leak. Where reads are served from (the primary, replicas, read models) and how stale they may be is decided in the Data consistency pack; the CDN hosting and the caching of a front end's static files in the Infrastructure and Frontend stack packs; the latency budget in the Capacity and scaling pack; whether personal data may sit in a cache, and how erasure reaches it, in the Personal data and Data classification packs; the tenant in every cache key in the Tenant isolation pack.",
728
+ "decision": "Each instance keeps a size-bounded in-process cache, made in one place (src/cache/local): Caffeine on the JVM (maximumSize and expireAfterWrite, W-TinyLFU eviction), lru-cache in Node.js (max, ttl and a fetchMethod), MemoryCache with a SizeLimit in .NET. It holds at most {{LOCAL_MAX_ENTRIES}} entries per instance, each for at most {{TTL_SECONDS}} seconds. Loads go through the cache's own loader (Caffeine get with a mapping function or a LoadingCache; lru-cache fetch), never a get followed by a separate put. Invalidation: {{INVALIDATION}}; with several instances, an entry removed on a change is removed in every instance by a broadcast each instance subscribes to (Redis pub/sub or a fan-out topic of the broker), within {{INVALIDATE_SECONDS}} seconds of the commit. Concurrent misses for one key: {{STAMPEDE}}. Decisions that write read the store inside their transaction, never the cache. The staleness the TTL allows must fit the read decision of the Data consistency pack.",
729
+ "consequences": "• The fastest hit there is: no network and no serialisation.\n• One copy per instance: memory times the instances, one miss per instance per key, and a new instance starts cold.\n• Instances may disagree until a removal reaches all of them, or the TTL passes.\n• The cache lives in the process's memory: its bound is what keeps it from growing the heap until the instance dies.\n• Nothing to run outside the process, and no cache outage to design for.",
730
+ "alternatives": "1. A shared cache (Redis or Valkey): one copy for all instances, at the cost of a store and a hop.\n2. HTTP caching at the edge: nothing in the element, but only for responses that are the same for everyone.\n3. Both tiers, an in-process cache in front of a shared one: fewer hops, two layers to invalidate; added when measurements show the shared cache's round trip matters.",
731
+ "hubWhen": {
732
+ "WHERE": [
733
+ "local"
734
+ ]
735
+ }
736
+ },
737
+ {
738
+ "id": "adr-none",
739
+ "type": "adr",
740
+ "label": "No cache",
741
+ "x": 780,
742
+ "y": 390,
743
+ "concern": "caching",
744
+ "status": "accepted",
745
+ "date": "",
746
+ "context": "This element reads from a data store, and some of what it reads is read far more often than it changes. The forces: a cache cuts latency and load on the store, but every cached entry is a second copy that is wrong from the moment the data changes until it expires or is removed; a lost or late invalidation shows users old data, and a write decided on a cached value loses an update; when a hot entry expires, every request that misses at once goes to the store (a stampede); a cache creates two code paths, and a store sized for the traffic the cache lets through browns out when the cache is empty or down; and a response cached for everyone that was meant for one caller is a data leak. Where reads are served from (the primary, replicas, read models) and how stale they may be is decided in the Data consistency pack; the CDN hosting and the caching of a front end's static files in the Infrastructure and Frontend stack packs; the latency budget in the Capacity and scaling pack; whether personal data may sit in a cache, and how erasure reaches it, in the Personal data and Data classification packs; the tenant in every cache key in the Tenant isolation pack. Here the store meets the latency budget and carries the reads, so a second copy would add staleness and a failure mode for nothing.",
747
+ "decision": "No cache stands between this element and its store: every read goes to the store as the Data consistency pack's read decision says, and no code keeps copies of the store's data between requests (no Redis for data, no in-process cache, no memoised query results). HTTP responses still say how browsers and proxies may keep them: Cache-Control on every GET, private or no-store for personal data. Revisit when the reads exceed the latency budget of the Capacity and scaling pack or the store's capacity; adding a cache supersedes this decision.",
748
+ "consequences": "• No stale data, nothing to invalidate, and no second store to run or to fail.\n• Every read costs a store round trip, and the store carries the whole read load: scaling reads means replicas (the Data consistency pack) or a bigger store.\n• The first cache needs this decision superseded, which brings its staleness and failure mode into the open.",
749
+ "alternatives": "1. A shared cache (Redis or Valkey) with cache-aside.\n2. An in-process cache in each instance.\n3. HTTP caching at the edge, for responses that are the same for everyone.",
750
+ "hubWhen": {
751
+ "WHERE": [
752
+ "none"
753
+ ]
754
+ }
755
+ },
756
+ {
757
+ "id": "ff-cache-control",
758
+ "type": "fitness-fn",
759
+ "label": "Cache headers right on every route",
760
+ "x": 1040,
761
+ "y": 0,
762
+ "characteristic": "security",
763
+ "scope": "atomic",
764
+ "cadence": "triggered",
765
+ "trigger": "pull-request",
766
+ "invocation": "automated",
767
+ "description": "A test lists the GET routes from the router's table (not from a list kept by hand), calls each as a signed-in user and reads its Cache-Control. A route on the personal list must be private or no-store; a response marked for shared caches (public or s-maxage) must carry an ETag and a lifetime, s-maxage (or max-age) plus stale-while-revalidate, within the TTL, and a second request with its ETag must get 304. A new route without a policy fails the test in its pull request.\n\nThreshold: 100% of GET routes answer with Cache-Control; personal routes private or no-store and never public; every response a shared cache may keep has an ETag, a lifetime of at most {{TTL_SECONDS}} seconds and answers If-None-Match with 304\n\nTool: Vitest with supertest (or the test runner and HTTP client of your stack: JUnit with MockMvc, xUnit with WebApplicationFactory)\n\n```ts\nimport request from 'supertest'\nimport { app, routes } from '../src/app' // routes: the router's table, each with an example path\nimport { PERSONAL } from '../src/http/cachePolicy' // the GET routes whose answers carry personal data or depend on the caller\nimport { signIn } from './cache/fixtures'\n\nconst TTL_SECONDS = {{TTL_SECONDS}}\nconst token = await signIn()\nconst seconds = (cc: string, name: string) => Number(cc.split(',').map((d) => d.trim()).find((d) => d.startsWith(`${name}=`))?.slice(name.length + 1) ?? NaN)\n\ndescribe.each(routes.filter((r) => r.method === 'GET'))('GET $path', (route) => {\n it('says who may keep the answer, and for how long', async () => {\n const res = await request(app).get(route.example).set('Authorization', `Bearer ${token}`).expect(200)\n const cc = String(res.headers['cache-control'] ?? '')\n expect(cc, 'an explicit Cache-Control').not.toBe('')\n if (PERSONAL.has(route.path)) {\n expect(cc).toMatch(/\\b(private|no-store)\\b/)\n return expect(cc).not.toMatch(/\\bpublic\\b|s-maxage/)\n }\n if (!/\\bpublic\\b|s-maxage/.test(cc)) return // not for shared caches\n const fresh = Number.isNaN(seconds(cc, 's-maxage')) ? seconds(cc, 'max-age') : seconds(cc, 's-maxage')\n expect(fresh + (seconds(cc, 'stale-while-revalidate') || 0)).toBeLessThanOrEqual(TTL_SECONDS)\n expect(res.headers.etag, 'an ETag to revalidate with').toBeTruthy()\n await request(app).get(route.example).set('Authorization', `Bearer ${token}`).set('If-None-Match', res.headers.etag).expect(304)\n })\n})\n```"
768
+ },
769
+ {
770
+ "id": "ff-no-cache",
771
+ "type": "fitness-fn",
772
+ "label": "No cache arrives unannounced",
773
+ "x": 1040,
774
+ "y": 130,
775
+ "characteristic": "maintainability",
776
+ "scope": "atomic",
777
+ "cadence": "triggered",
778
+ "trigger": "pull-request",
779
+ "invocation": "automated",
780
+ "description": "A dependency rule fails the build when code under src imports a Redis, Valkey or Memcached client or an in-process cache library, which would mean a cache arrived without its decision. The modules that keep idempotency keys, rate-limit counters or sessions in a Redis by other decisions are left out by path.\n\nThreshold: 0 modules under src, outside the modules other decisions give a Redis of their own, import a cache client or an in-process cache library\n\nTool: dependency-cruiser (or the equivalent for your stack: an ArchUnit rule forbidding com.github.benmanes.caffeine, io.lettuce, redis.clients.jedis and org.springframework.cache)\n\n```js\n// .dependency-cruiser.cjs\nmodule.exports = {\n forbidden: [{\n name: 'no-cache',\n comment: 'ADR No cache: supersede it before keeping copies of the store\\'s data. Redis for idempotency keys, rate limits and sessions is decided elsewhere.',\n severity: 'error',\n from: { path: '^src/', pathNot: '^src/(idempotency|rate-limit|sessions)/' },\n to: { path: '^node_modules/(ioredis|redis|iovalkey|memjs|memcached|lru-cache|node-cache|keyv|cache-manager|@redis/[^/]+|@valkey/[^/]+|@keyv/[^/]+|@isaacs/ttlcache)/' },\n }],\n}\n```",
781
+ "hubWhen": {
782
+ "WHERE": [
783
+ "none"
784
+ ]
785
+ }
786
+ },
787
+ {
788
+ "id": "ff-shared-config",
789
+ "type": "fitness-fn",
790
+ "label": "Cache Redis bounded, every key expiring",
791
+ "x": 1040,
792
+ "y": 260,
793
+ "characteristic": "reliability",
794
+ "scope": "atomic",
795
+ "cadence": "continual",
796
+ "invocation": "automated",
797
+ "description": "A script run after every deploy and hourly by the monitoring job reads the cache's memory settings with INFO memory (which managed services allow where CONFIG GET is disabled) and scans the cache keys without blocking Redis (SCAN), failing on a key with no expiry or a longer one.\n\nThreshold: maxmemory above 0 and maxmemory-policy allkeys-lru or allkeys-lfu; 0 cache keys without an expiry or with more than {{TTL_SECONDS}} seconds left\n\nTool: redis-cli in a shell step (REDIS_URL points at the cache's own Redis or Valkey; valkey-cli takes the same arguments)\n\n```bash\nset -euo pipefail\ninfo=$(redis-cli -u \"$REDIS_URL\" --raw INFO memory | tr -d '\\r')\npolicy=$(awk -F: '$1 == \"maxmemory_policy\" { print $2 }' <<<\"$info\")\nmax=$(awk -F: '$1 == \"maxmemory\" { print $2 }' <<<\"$info\")\n[[ \"$policy\" == allkeys-lru || \"$policy\" == allkeys-lfu ]] || { echo \"eviction policy $policy: the cache needs allkeys-lru or allkeys-lfu\"; exit 1; }\n[ \"$max\" -gt 0 ] || { echo \"maxmemory is 0: the cache grows until the host runs out of memory\"; exit 1; }\nbad=0\nwhile read -r key; do\n ttl=$(redis-cli -u \"$REDIS_URL\" --raw TTL \"$key\" < /dev/null)\n [ \"$ttl\" -eq -2 ] && continue # expired during the scan\n if [ \"$ttl\" -lt 0 ] || [ \"$ttl\" -gt {{TTL_SECONDS}} ]; then echo \"$key: TTL $ttl\"; bad=1; fi\ndone < <(redis-cli -u \"$REDIS_URL\" --scan --pattern 'cache:*')\nexit $bad\n```",
798
+ "hubWhen": {
799
+ "WHERE": [
800
+ "shared"
801
+ ]
802
+ }
803
+ },
804
+ {
805
+ "id": "ff-local-bounded",
806
+ "type": "fitness-fn",
807
+ "label": "In-process cache bounded in size and age",
808
+ "x": 1040,
809
+ "y": 390,
810
+ "characteristic": "performance-efficiency",
811
+ "scope": "atomic",
812
+ "cadence": "triggered",
813
+ "trigger": "pull-request",
814
+ "invocation": "automated",
815
+ "description": "A unit test builds the cache with its production settings from the one module that makes it, checks the bound and the TTL, then loads 1,000 more keys than the bound and checks that it evicted instead of growing.\n\nThreshold: The cache's bound is at most {{LOCAL_MAX_ENTRIES}} entries and its TTL above 0 and at most {{TTL_SECONDS}} seconds; after 1,000 more keys than the bound, it holds at most {{LOCAL_MAX_ENTRIES}}\n\nTool: Vitest over lru-cache; for the JVM: JUnit over Caffeine, reading cache.policy().eviction() and cache.policy().expireAfterWrite()\n\n```ts\nimport { expect, it } from 'vitest'\nimport { createProductCache } from '../src/cache/local' // the in-process cache with its production settings (lru-cache)\n\nconst MAX_ENTRIES = {{LOCAL_MAX_ENTRIES}}\nconst TTL_SECONDS = {{TTL_SECONDS}}\n\nit('is bounded in size and in age', () => {\n const cache = createProductCache()\n expect(cache.max).toBeLessThanOrEqual(MAX_ENTRIES)\n expect(cache.ttl).toBeGreaterThan(0)\n expect(cache.ttl).toBeLessThanOrEqual(TTL_SECONDS * 1000)\n})\n\nit('evicts instead of growing past the bound', async () => {\n const cache = createProductCache({ load: async (id: string) => ({ id }) })\n for (let i = 0; i < MAX_ENTRIES + 1000; i++) await cache.fetch(String(i))\n expect(cache.size).toBeLessThanOrEqual(MAX_ENTRIES)\n})\n```",
816
+ "hubWhen": {
817
+ "WHERE": [
818
+ "local"
819
+ ]
820
+ }
821
+ },
822
+ {
823
+ "id": "ff-invalidate",
824
+ "type": "fitness-fn",
825
+ "label": "A change reaches every reader in time",
826
+ "x": 1040,
827
+ "y": 520,
828
+ "characteristic": "functional-suitability",
829
+ "scope": "holistic",
830
+ "cadence": "triggered",
831
+ "trigger": "deploy",
832
+ "invocation": "automated",
833
+ "description": "An integration test against a deployed environment reads one product through every reader so that each has it cached, changes its price through the API, and polls every reader until it serves the new price, failing past the bound. With deletion by change events, a second run makes the change with SQL straight in the store, as a job or another service would, and expects the same.\n\nThreshold: Every reader (each instance, or the CDN) serves the changed value within {{INVALIDATE_SECONDS}} seconds of the write\n\nTool: Vitest with fetch against the environment (READ_URLS lists each instance's own address, or the CDN's; for the JVM: JUnit with the HTTP client)\n\n```ts\nimport { expect, it } from 'vitest'\n\nconst READ_URLS = process.env.READ_URLS!.split(',') // every instance's own address, or the CDN's\nconst WRITE_URL = process.env.WRITE_URL!\nconst INVALIDATE_SECONDS = {{INVALIDATE_SECONDS}}\nconst price = (url: string) => fetch(`${url}/products/42`).then((r) => r.json()).then((p) => p.price as number)\n\nit('a committed change reaches every reader within the bound', async () => {\n const before = await Promise.all(READ_URLS.map(price)) // now cached by every reader\n const changed = before[0] + 1\n const write = await fetch(`${WRITE_URL}/products/42`, {\n method: 'PATCH',\n headers: { 'content-type': 'application/json', authorization: `Bearer ${process.env.WRITER_TOKEN}` },\n body: JSON.stringify({ price: changed }),\n })\n expect(write.ok).toBe(true)\n const committed = Date.now()\n for (const url of READ_URLS) {\n while ((await price(url)) !== changed) {\n expect(Date.now() - committed).toBeLessThan(INVALIDATE_SECONDS * 1000)\n await new Promise((r) => setTimeout(r, 200))\n }\n }\n}, 60_000)\n```",
834
+ "hubWhen": {
835
+ "WHERE": [
836
+ "edge",
837
+ "shared",
838
+ "local"
839
+ ],
840
+ "INVALIDATION": [
841
+ "delete",
842
+ "event"
843
+ ]
844
+ }
845
+ },
846
+ {
847
+ "id": "ff-writes-bypass",
848
+ "type": "fitness-fn",
849
+ "label": "Commands never read the cache",
850
+ "x": 1040,
851
+ "y": 650,
852
+ "characteristic": "functional-suitability",
853
+ "scope": "atomic",
854
+ "cadence": "triggered",
855
+ "trigger": "pull-request",
856
+ "invocation": "automated",
857
+ "description": "A dependency rule follows every import from the operations that change data and fails the build when one of them reaches the cached reads. Removing entries after a write (src/cache/invalidate) stays allowed.\n\nThreshold: 0 modules under src/commands that reach src/cache/read, directly or through other modules\n\nTool: dependency-cruiser (reachable rule); for the JVM: an ArchUnit rule that classes in ..commands.. do not depend on ..cache.read..\n\n```js\n// .dependency-cruiser.cjs\nmodule.exports = {\n forbidden: [{\n name: 'writes-decide-on-the-store',\n comment: 'ADR cache: a decision that writes reads the store inside its transaction, never a cached entry (src/cache/invalidate stays allowed)',\n severity: 'error',\n from: { path: '^src/commands/' },\n to: { path: '^src/cache/read', reachable: true },\n }],\n options: { tsConfig: { fileName: 'tsconfig.json' } },\n}\n```",
858
+ "hubWhen": {
859
+ "WHERE": [
860
+ "shared",
861
+ "local"
862
+ ]
863
+ }
864
+ },
865
+ {
866
+ "id": "ff-coalesce",
867
+ "type": "fitness-fn",
868
+ "label": "Concurrent misses read the store once",
869
+ "x": 1040,
870
+ "y": 780,
871
+ "characteristic": "performance-efficiency",
872
+ "scope": "atomic",
873
+ "cadence": "triggered",
874
+ "trigger": "pull-request",
875
+ "invocation": "automated",
876
+ "description": "A test forgets one key, starts 100 reads of it at once through the cached reads and counts the calls to the store. With a shared cache it runs against a Redis started by Testcontainers; with an in-process cache, against the cache itself.\n\nThreshold: 100 concurrent reads of one uncached key cause exactly 1 store read and return 1 value\n\nTool: Vitest (vi.spyOn on the store reads); for the JVM: JUnit with Caffeine's AsyncLoadingCache or the Redis client of the decision\n\n```ts\nimport { expect, it, vi } from 'vitest'\nimport { products } from '../src/cache/read' // the cached reads: getOrLoad and forget\nimport { productStore } from '../src/catalog/store' // the store reads a miss falls back to\n\nit('100 concurrent misses for one key read the store once', async () => {\n const read = vi.spyOn(productStore, 'findById')\n await products.forget('42') // a cold key\n const answers = await Promise.all(Array.from({ length: 100 }, () => products.getOrLoad('42')))\n expect(read).toHaveBeenCalledTimes(1)\n expect(new Set(answers.map((p) => JSON.stringify(p))).size).toBe(1)\n})\n```",
877
+ "hubWhen": {
878
+ "WHERE": [
879
+ "shared",
880
+ "local"
881
+ ],
882
+ "STAMPEDE": [
883
+ "coalesce"
884
+ ]
885
+ }
886
+ },
887
+ {
888
+ "id": "ff-early",
889
+ "type": "fitness-fn",
890
+ "label": "Hot entries refreshed just before expiry",
891
+ "x": 1040,
892
+ "y": 910,
893
+ "characteristic": "performance-efficiency",
894
+ "scope": "atomic",
895
+ "cadence": "triggered",
896
+ "trigger": "pull-request",
897
+ "invocation": "automated",
898
+ "description": "A unit test drives the early-refresh check with a read every millisecond across the entry's life and records the first read that refreshes it. With XFetch, the chance of a refresh more than 1 second (20 load times) early is about 50 times e to the minus 20, so the test is stable.\n\nThreshold: For an entry read every millisecond whose load took 50 ms, a refresh happens before expiry and less than 1 second before it\n\nTool: Vitest; for the JVM: JUnit over the same check (Caffeine's refreshAfterWrite refreshes at a fixed age, not probabilistically, so the check is code of your own)\n\n```ts\nimport { expect, it } from 'vitest'\nimport { refreshEarly } from '../src/cache/xfetch' // true when now - delta * beta * ln(random()) >= expiry\n\nit('refreshes a hot entry before it expires, and not long before', () => {\n const expiry = {{TTL_SECONDS}} * 1000\n const delta = 50 // the last load took 50 ms\n let refreshedAt: number | undefined\n for (let now = 0; now < expiry && refreshedAt === undefined; now += 1) { // a read every millisecond\n if (refreshEarly({ now, expiry, delta, beta: 1 })) refreshedAt = now\n }\n expect(refreshedAt).toBeDefined()\n expect(expiry - refreshedAt!).toBeLessThan(1000)\n})\n```",
899
+ "hubWhen": {
900
+ "WHERE": [
901
+ "shared",
902
+ "local"
903
+ ],
904
+ "STAMPEDE": [
905
+ "early"
906
+ ]
907
+ }
908
+ },
909
+ {
910
+ "id": "ff-cold-cache",
911
+ "type": "fitness-fn",
912
+ "label": "The store carries the peak on a cold cache",
913
+ "x": 1040,
914
+ "y": 1040,
915
+ "characteristic": "performance-efficiency",
916
+ "scope": "holistic",
917
+ "cadence": "temporal",
918
+ "every": "30d",
919
+ "invocation": "automated",
920
+ "description": "The scheduled load job empties the cache (FLUSHDB on the cache's own Redis, or a rolling restart for in-process caches) and at once runs k6 at the peak rate against 20 hot keys, the shape that makes a stampede. PEAK_RPS and P95_MS come from the Capacity and scaling pack's decision.\n\nThreshold: With the cache emptied, 5 minutes at the peak read rate on 20 hot keys: errors under 0.1 % and the 95th percentile under the latency budget of the Capacity and scaling pack\n\nTool: k6 (constant-arrival-rate executor and thresholds), run by the scheduled load job\n\n```js\n// load/cold-cache.js, run right after emptying the cache:\n// shared cache: redis-cli -u \"$REDIS_URL\" FLUSHDB; in-process caches: a rolling restart of the instances\nimport http from 'k6/http'\n\nexport const options = {\n scenarios: {\n cold: { executor: 'constant-arrival-rate', rate: Number(__ENV.PEAK_RPS), timeUnit: '1s', duration: '5m', preAllocatedVUs: 200, maxVUs: 1000 },\n },\n thresholds: {\n http_req_failed: ['rate<0.001'],\n http_req_duration: [`p(95)<${__ENV.P95_MS}`], // the latency budget of the Capacity and scaling pack\n },\n}\n\nexport default function () {\n http.get(`${__ENV.BASE_URL}/products/${1 + Math.floor(Math.random() * 20)}`) // 20 hot keys\n}\n```",
921
+ "hubWhen": {
922
+ "WHERE": [
923
+ "shared",
924
+ "local"
925
+ ],
926
+ "STAMPEDE": [
927
+ "none"
928
+ ]
929
+ }
930
+ },
931
+ {
932
+ "id": "ff-down-store",
933
+ "type": "fitness-fn",
934
+ "label": "Cache outage falls back within a limit",
935
+ "x": 1040,
936
+ "y": 1170,
937
+ "characteristic": "reliability",
938
+ "scope": "atomic",
939
+ "cadence": "triggered",
940
+ "trigger": "pull-request",
941
+ "invocation": "automated",
942
+ "description": "An integration test starts Redis in a container, builds the app on it, warms one key, stops the container and fires 200 reads at 50 keys. A probe around the store reads records how many ran at once.\n\nThreshold: With the cache container stopped, 200 concurrent reads answer only 200 or 503 with Retry-After, at least one 200, and at most {{FALLBACK_CONCURRENCY}} store reads run at once\n\nTool: Vitest with supertest and Testcontainers (@testcontainers/redis); for the JVM: JUnit with Testcontainers and Resilience4j's CircuitBreaker and Bulkhead\n\n```ts\nimport request from 'supertest'\nimport { expect, it } from 'vitest'\nimport { RedisContainer } from '@testcontainers/redis'\nimport { createApp } from '../src/app' // the app, built on the given cache\nimport { storeProbe } from './cache/storeProbe' // counts the store reads, and how many ran at once\n\nconst FALLBACK_CONCURRENCY = {{FALLBACK_CONCURRENCY}}\n\nit('reads from the store, a limited number at a time, while the cache is down', async () => {\n const redis = await new RedisContainer('redis:7.4').start()\n const app = createApp({ cacheUrl: redis.getConnectionUrl() })\n await request(app).get('/products/1').expect(200) // warms the cache\n await redis.stop()\n storeProbe.reset()\n const answers = await Promise.all(Array.from({ length: 200 }, (_, i) => request(app).get(`/products/${1 + (i % 50)}`)))\n for (const a of answers) expect(a.status === 200 || (a.status === 503 && a.headers['retry-after'] !== undefined)).toBe(true)\n expect(answers.filter((a) => a.status === 200).length).toBeGreaterThan(0)\n expect(storeProbe.maxConcurrent()).toBeLessThanOrEqual(FALLBACK_CONCURRENCY)\n}, 60_000)\n```",
943
+ "hubWhen": {
944
+ "WHERE": [
945
+ "shared"
946
+ ],
947
+ "DOWN": [
948
+ "store"
949
+ ]
950
+ }
951
+ },
952
+ {
953
+ "id": "ff-down-fail",
954
+ "type": "fitness-fn",
955
+ "label": "Cache outage refused fast",
956
+ "x": 1040,
957
+ "y": 1300,
958
+ "characteristic": "reliability",
959
+ "scope": "atomic",
960
+ "cadence": "triggered",
961
+ "trigger": "pull-request",
962
+ "invocation": "automated",
963
+ "description": "An integration test starts Redis in a container, builds the app on it, warms one key, stops the container, then times one read and counts the store reads it caused.\n\nThreshold: With the cache container stopped, a read is answered 503 with Retry-After within {{CACHE_TIMEOUT_MS}} ms plus 100 ms, and 0 store reads happen\n\nTool: Vitest with supertest and Testcontainers (@testcontainers/redis); for the JVM: JUnit with Testcontainers\n\n```ts\nimport request from 'supertest'\nimport { expect, it } from 'vitest'\nimport { RedisContainer } from '@testcontainers/redis'\nimport { createApp } from '../src/app' // the app, built on the given cache\nimport { storeProbe } from './cache/storeProbe' // counts the store reads\n\nconst CACHE_TIMEOUT_MS = {{CACHE_TIMEOUT_MS}}\n\nit('refuses reads at once while the cache is down, sparing the store', async () => {\n const redis = await new RedisContainer('redis:7.4').start()\n const app = createApp({ cacheUrl: redis.getConnectionUrl() })\n await request(app).get('/products/1').expect(200) // warms the cache\n await redis.stop()\n storeProbe.reset()\n const started = Date.now()\n const res = await request(app).get('/products/2')\n expect(res.status).toBe(503)\n expect(res.headers['retry-after']).toBeDefined()\n expect(Date.now() - started).toBeLessThan(CACHE_TIMEOUT_MS + 100)\n expect(storeProbe.total()).toBe(0)\n}, 60_000)\n```",
964
+ "hubWhen": {
965
+ "WHERE": [
966
+ "shared"
967
+ ],
968
+ "DOWN": [
969
+ "fail"
970
+ ]
971
+ }
972
+ },
973
+ {
974
+ "id": "ff-hit-ratio",
975
+ "type": "fitness-fn",
976
+ "label": "Hit ratio watched",
977
+ "x": 1040,
978
+ "y": 1430,
979
+ "characteristic": "performance-efficiency",
980
+ "scope": "atomic",
981
+ "cadence": "continual",
982
+ "invocation": "automated",
983
+ "description": "Prometheus computes the hit ratio over an hour. For a shared cache, from redis_exporter's keyspace counters of the cache's own Redis (meaningful because nothing else uses it); for an in-process cache, from the cache.gets meter that Micrometer's Caffeine binder exports (in Node.js, a prom-client counter of the same name and labels). Keep the rule of the cache the decision names.\n\nThreshold: An alert opens a ticket when the share of lookups answered from the cache over the last hour stays below {{HIT_RATIO}} % for 15 minutes\n\nTool: Prometheus alerting rules over redis_exporter (shared cache) or Micrometer's CaffeineCacheMetrics (in-process cache)\n\n```yaml\ngroups:\n - name: cache\n rules:\n - alert: SharedCacheHitRatioLow # the cache's own Redis or Valkey, scraped by redis_exporter\n expr: |\n sum by (instance) (rate(redis_keyspace_hits_total[1h]))\n / (sum by (instance) (rate(redis_keyspace_hits_total[1h])) + sum by (instance) (rate(redis_keyspace_misses_total[1h])))\n < {{HIT_RATIO}} / 100\n for: 15m\n labels: { severity: ticket }\n annotations:\n summary: \"Cache {{ $labels.instance }} answers only {{ $value | humanizePercentage }} of lookups\"\n - alert: LocalCacheHitRatioLow # Micrometer's Caffeine binder: cache_gets_total{cache, result=\"hit\"|\"miss\"}\n expr: |\n sum by (cache) (rate(cache_gets_total{result=\"hit\"}[1h])) / sum by (cache) (rate(cache_gets_total[1h])) < {{HIT_RATIO}} / 100\n for: 15m\n labels: { severity: ticket }\n annotations:\n summary: \"In-process cache {{ $labels.cache }} answers only {{ $value | humanizePercentage }} of lookups\"\n```",
984
+ "hubWhen": {
985
+ "WHERE": [
986
+ "shared",
987
+ "local"
988
+ ]
989
+ }
990
+ }
991
+ ],
992
+ "relations": [
993
+ {
994
+ "id": "req-cache-control--derives--need",
995
+ "sourceId": "req-cache-control",
996
+ "targetId": "need",
997
+ "relationType": "derives"
998
+ },
999
+ {
1000
+ "id": "req-no-cache--derives--need",
1001
+ "sourceId": "req-no-cache",
1002
+ "targetId": "need",
1003
+ "relationType": "derives"
1004
+ },
1005
+ {
1006
+ "id": "req-expiry--derives--need",
1007
+ "sourceId": "req-expiry",
1008
+ "targetId": "need",
1009
+ "relationType": "derives"
1010
+ },
1011
+ {
1012
+ "id": "req-invalidate--derives--need",
1013
+ "sourceId": "req-invalidate",
1014
+ "targetId": "need",
1015
+ "relationType": "derives"
1016
+ },
1017
+ {
1018
+ "id": "req-writes-bypass--derives--need",
1019
+ "sourceId": "req-writes-bypass",
1020
+ "targetId": "need",
1021
+ "relationType": "derives"
1022
+ },
1023
+ {
1024
+ "id": "req-coalesce--derives--need",
1025
+ "sourceId": "req-coalesce",
1026
+ "targetId": "need",
1027
+ "relationType": "derives"
1028
+ },
1029
+ {
1030
+ "id": "req-early--derives--need",
1031
+ "sourceId": "req-early",
1032
+ "targetId": "need",
1033
+ "relationType": "derives"
1034
+ },
1035
+ {
1036
+ "id": "req-cold--derives--need",
1037
+ "sourceId": "req-cold",
1038
+ "targetId": "need",
1039
+ "relationType": "derives"
1040
+ },
1041
+ {
1042
+ "id": "req-down-store--derives--need",
1043
+ "sourceId": "req-down-store",
1044
+ "targetId": "need",
1045
+ "relationType": "derives"
1046
+ },
1047
+ {
1048
+ "id": "req-down-fail--derives--need",
1049
+ "sourceId": "req-down-fail",
1050
+ "targetId": "need",
1051
+ "relationType": "derives"
1052
+ },
1053
+ {
1054
+ "id": "req-local-bound--derives--need",
1055
+ "sourceId": "req-local-bound",
1056
+ "targetId": "need",
1057
+ "relationType": "derives"
1058
+ },
1059
+ {
1060
+ "id": "req-shared-own--derives--need",
1061
+ "sourceId": "req-shared-own",
1062
+ "targetId": "need",
1063
+ "relationType": "derives"
1064
+ },
1065
+ {
1066
+ "id": "req-hit-ratio--derives--need",
1067
+ "sourceId": "req-hit-ratio",
1068
+ "targetId": "need",
1069
+ "relationType": "derives"
1070
+ },
1071
+ {
1072
+ "id": "req-conditional--derives--need",
1073
+ "sourceId": "req-conditional",
1074
+ "targetId": "need",
1075
+ "relationType": "derives"
1076
+ },
1077
+ {
1078
+ "id": "sc-cache-control--verifies--req-cache-control",
1079
+ "sourceId": "sc-cache-control",
1080
+ "targetId": "req-cache-control",
1081
+ "relationType": "verifies"
1082
+ },
1083
+ {
1084
+ "id": "sc-no-cache--verifies--req-no-cache",
1085
+ "sourceId": "sc-no-cache",
1086
+ "targetId": "req-no-cache",
1087
+ "relationType": "verifies"
1088
+ },
1089
+ {
1090
+ "id": "sc-expiry--verifies--req-expiry",
1091
+ "sourceId": "sc-expiry",
1092
+ "targetId": "req-expiry",
1093
+ "relationType": "verifies"
1094
+ },
1095
+ {
1096
+ "id": "sc-invalidate--verifies--req-invalidate",
1097
+ "sourceId": "sc-invalidate",
1098
+ "targetId": "req-invalidate",
1099
+ "relationType": "verifies"
1100
+ },
1101
+ {
1102
+ "id": "sc-writes-bypass--verifies--req-writes-bypass",
1103
+ "sourceId": "sc-writes-bypass",
1104
+ "targetId": "req-writes-bypass",
1105
+ "relationType": "verifies"
1106
+ },
1107
+ {
1108
+ "id": "sc-coalesce--verifies--req-coalesce",
1109
+ "sourceId": "sc-coalesce",
1110
+ "targetId": "req-coalesce",
1111
+ "relationType": "verifies"
1112
+ },
1113
+ {
1114
+ "id": "sc-early--verifies--req-early",
1115
+ "sourceId": "sc-early",
1116
+ "targetId": "req-early",
1117
+ "relationType": "verifies"
1118
+ },
1119
+ {
1120
+ "id": "sc-cold--verifies--req-cold",
1121
+ "sourceId": "sc-cold",
1122
+ "targetId": "req-cold",
1123
+ "relationType": "verifies"
1124
+ },
1125
+ {
1126
+ "id": "sc-down-store--verifies--req-down-store",
1127
+ "sourceId": "sc-down-store",
1128
+ "targetId": "req-down-store",
1129
+ "relationType": "verifies"
1130
+ },
1131
+ {
1132
+ "id": "sc-down-fail--verifies--req-down-fail",
1133
+ "sourceId": "sc-down-fail",
1134
+ "targetId": "req-down-fail",
1135
+ "relationType": "verifies"
1136
+ },
1137
+ {
1138
+ "id": "sc-local-bound--verifies--req-local-bound",
1139
+ "sourceId": "sc-local-bound",
1140
+ "targetId": "req-local-bound",
1141
+ "relationType": "verifies"
1142
+ },
1143
+ {
1144
+ "id": "sc-shared-own--verifies--req-shared-own",
1145
+ "sourceId": "sc-shared-own",
1146
+ "targetId": "req-shared-own",
1147
+ "relationType": "verifies"
1148
+ },
1149
+ {
1150
+ "id": "sc-hit-ratio--verifies--req-hit-ratio",
1151
+ "sourceId": "sc-hit-ratio",
1152
+ "targetId": "req-hit-ratio",
1153
+ "relationType": "verifies"
1154
+ },
1155
+ {
1156
+ "id": "sc-conditional--verifies--req-conditional",
1157
+ "sourceId": "sc-conditional",
1158
+ "targetId": "req-conditional",
1159
+ "relationType": "verifies"
1160
+ },
1161
+ {
1162
+ "id": "ff-cache-control--implements--adr-edge",
1163
+ "sourceId": "ff-cache-control",
1164
+ "targetId": "adr-edge",
1165
+ "relationType": "implements"
1166
+ },
1167
+ {
1168
+ "id": "ff-cache-control--implements--adr-shared",
1169
+ "sourceId": "ff-cache-control",
1170
+ "targetId": "adr-shared",
1171
+ "relationType": "implements"
1172
+ },
1173
+ {
1174
+ "id": "ff-cache-control--implements--adr-local",
1175
+ "sourceId": "ff-cache-control",
1176
+ "targetId": "adr-local",
1177
+ "relationType": "implements"
1178
+ },
1179
+ {
1180
+ "id": "ff-cache-control--implements--adr-none",
1181
+ "sourceId": "ff-cache-control",
1182
+ "targetId": "adr-none",
1183
+ "relationType": "implements"
1184
+ },
1185
+ {
1186
+ "id": "ff-no-cache--implements--adr-none",
1187
+ "sourceId": "ff-no-cache",
1188
+ "targetId": "adr-none",
1189
+ "relationType": "implements"
1190
+ },
1191
+ {
1192
+ "id": "ff-shared-config--implements--adr-shared",
1193
+ "sourceId": "ff-shared-config",
1194
+ "targetId": "adr-shared",
1195
+ "relationType": "implements"
1196
+ },
1197
+ {
1198
+ "id": "ff-local-bounded--implements--adr-local",
1199
+ "sourceId": "ff-local-bounded",
1200
+ "targetId": "adr-local",
1201
+ "relationType": "implements"
1202
+ },
1203
+ {
1204
+ "id": "ff-invalidate--implements--adr-edge",
1205
+ "sourceId": "ff-invalidate",
1206
+ "targetId": "adr-edge",
1207
+ "relationType": "implements"
1208
+ },
1209
+ {
1210
+ "id": "ff-invalidate--implements--adr-shared",
1211
+ "sourceId": "ff-invalidate",
1212
+ "targetId": "adr-shared",
1213
+ "relationType": "implements"
1214
+ },
1215
+ {
1216
+ "id": "ff-invalidate--implements--adr-local",
1217
+ "sourceId": "ff-invalidate",
1218
+ "targetId": "adr-local",
1219
+ "relationType": "implements"
1220
+ },
1221
+ {
1222
+ "id": "ff-writes-bypass--implements--adr-shared",
1223
+ "sourceId": "ff-writes-bypass",
1224
+ "targetId": "adr-shared",
1225
+ "relationType": "implements"
1226
+ },
1227
+ {
1228
+ "id": "ff-writes-bypass--implements--adr-local",
1229
+ "sourceId": "ff-writes-bypass",
1230
+ "targetId": "adr-local",
1231
+ "relationType": "implements"
1232
+ },
1233
+ {
1234
+ "id": "ff-coalesce--implements--adr-shared",
1235
+ "sourceId": "ff-coalesce",
1236
+ "targetId": "adr-shared",
1237
+ "relationType": "implements"
1238
+ },
1239
+ {
1240
+ "id": "ff-coalesce--implements--adr-local",
1241
+ "sourceId": "ff-coalesce",
1242
+ "targetId": "adr-local",
1243
+ "relationType": "implements"
1244
+ },
1245
+ {
1246
+ "id": "ff-early--implements--adr-shared",
1247
+ "sourceId": "ff-early",
1248
+ "targetId": "adr-shared",
1249
+ "relationType": "implements"
1250
+ },
1251
+ {
1252
+ "id": "ff-early--implements--adr-local",
1253
+ "sourceId": "ff-early",
1254
+ "targetId": "adr-local",
1255
+ "relationType": "implements"
1256
+ },
1257
+ {
1258
+ "id": "ff-cold-cache--implements--adr-shared",
1259
+ "sourceId": "ff-cold-cache",
1260
+ "targetId": "adr-shared",
1261
+ "relationType": "implements"
1262
+ },
1263
+ {
1264
+ "id": "ff-cold-cache--implements--adr-local",
1265
+ "sourceId": "ff-cold-cache",
1266
+ "targetId": "adr-local",
1267
+ "relationType": "implements"
1268
+ },
1269
+ {
1270
+ "id": "ff-down-store--implements--adr-shared",
1271
+ "sourceId": "ff-down-store",
1272
+ "targetId": "adr-shared",
1273
+ "relationType": "implements"
1274
+ },
1275
+ {
1276
+ "id": "ff-down-fail--implements--adr-shared",
1277
+ "sourceId": "ff-down-fail",
1278
+ "targetId": "adr-shared",
1279
+ "relationType": "implements"
1280
+ },
1281
+ {
1282
+ "id": "ff-hit-ratio--implements--adr-shared",
1283
+ "sourceId": "ff-hit-ratio",
1284
+ "targetId": "adr-shared",
1285
+ "relationType": "implements"
1286
+ },
1287
+ {
1288
+ "id": "ff-hit-ratio--implements--adr-local",
1289
+ "sourceId": "ff-hit-ratio",
1290
+ "targetId": "adr-local",
1291
+ "relationType": "implements"
1292
+ }
1293
+ ]
1294
+ }