@open-mercato/cache 0.6.5-develop.4639.1.0416d895fa → 0.6.5-develop.4656.1.5b0d4fd8a6
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.
- package/AGENTS.md +6 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -46,6 +46,12 @@ await cacheService.set('key', value, { tags: ['tenant:123', 'customers'] })
|
|
|
46
46
|
await cacheService.invalidateTag('customers') // Clears all customer-related cache
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
## Consistency vs commit timing
|
|
50
|
+
|
|
51
|
+
Cache invalidation and query-index side effects (`emitCrudSideEffects`) MUST fire **after** the originating domain write commits — the same rule that keeps them OUTSIDE the `withAtomicFlush` block (see `packages/core/AGENTS.md` → "Entity Update Safety — `withAtomicFlush`"). Because invalidation runs post-commit and the query-index read-projection tail (search tokens, vectors, fulltext, coverage) converges asynchronously, reads can briefly see a short convergence window after a write.
|
|
52
|
+
|
|
53
|
+
An opt-in env flag, `OM_CACHE_SAFETY_ALWAYS_CONSISTENT` (default **OFF**, 100% backward compatible), is planned to make that read-projection tail converge synchronously on write so reads never observe the window — at the cost of added write latency. Frame it as opt-in/forthcoming; do not assume it is on. See `.ai/specs/2026-06-05-cache-safety-always-consistent.md`.
|
|
54
|
+
|
|
49
55
|
## Adding Caching to a Module
|
|
50
56
|
|
|
51
57
|
1. Resolve `cacheService` from DI in your service or route handler
|
package/package.json
CHANGED