NW.js App.clearCache() and HTTP Cache Persistence Limits
0 reputation · 23 Feb 2025, 02:57 UTC
Cache Invalidation in NW.js
NW.js applications utilize an embedded Chromium content shell, meaning resources loaded via DOM or network paths are subject to standard HTTP caching. This behavior creates a discrepancy where assets loaded via Node.js require() bypass the cache, while web-standard assets persist in the user-data directory across application restarts.
The App.clearCache() method is documented as the primary programmatic way to purge the Chromium HTTP cache. However, the scope of this operation is global to the application profile rather than granular per resource, and it does not automatically trigger upon application version increments.
When managing remote assets that must remain fresh, there is a design conflict between relying on server-side Cache-Control headers and implementing manual cache purging during the app boot sequence.
- Does
App.clearCache()impact the Cache Storage API used by Service Workers, or is it limited strictly to the Chromium HTTP cache? - What are the performance implications of calling this method on every launch versus implementing a version-check trigger?