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:

  1. Increase MicroCache budget (not recommended - localStorage has 5MB limit)
  2. Add pre-emptive size checks before MicroCache writes in gg-storage.ts
  3. Compress data before caching
  4. 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


🔗 Related


Auto-generated by MCP Smart Consolidation