Bugfix: How to fix MicroCache 'Entry too large' warning spam for lar...
Documentation for Sessions
🐛 Bugfix: How to fix MicroCache 'Entry too large' warning spam for lar...
📋 Decision Context
Question:
How to fix MicroCache 'Entry too large' warning spam for large NGXS state data (pages ~227KB)?
Task: Fix MicroCache entry too large error for pages key (227KB vs 100KB max)
🎯 Decision Made
Chosen:
Add pre-emptive size checks before MicroCache writes in gg-storage.ts
Options Considered:
- Increase MicroCache budget (not recommended - localStorage has 5MB limit)
- Add pre-emptive size checks before MicroCache writes in gg-storage.ts
- Compress data before caching
- Smart chunking/splitting of large data
💭 Reasoning
The root cause was that multiple code paths in gg-storage.ts (redundancy writes, cache updates) were attempting to write ALL non-flash keys to MicroCache without checking if the data size was appropriate. Created a helper method shouldUseMicroCacheForData() that pre-emptively checks: 1) flash: key prefix exclusion, 2) policy decision target, 3) data size vs maxEntrySize threshold. This prevents large NGXS states (pages, widgets ~200KB+) from ever attempting MicroCache write, eliminating the warning spam. Also made MicroCache warning conditional on STORAGE_DEBUG flag for expected rejections.
📁 Files Involved
libs/libs-foundational/storage-system/src/core/engine/gg-storage.tslibs/libs-foundational/storage-system/src/core/cache/micro-cache.ts
🔗 Related
- Decision ID:
dev_1767824909021_g8khy4x - Session: 22
- Workspace: editor2
Auto-generated by MCP Smart Consolidation