Cache dispatched Vuex actions to prevent repeated requests and heavy computations. Version 3.5.0 is stable, with regular maintenance. Supports Vue 2/3 and Vuex 1-3. Unlike manual caching, it provides a simple plugin-based API with `store.cache.dispatch`, `has`, `delete`, and `clear` methods. Uses action name and payload as cache key. ESM and CommonJS compatible, includes TypeScript definitions. Requires Map and Promise polyfills for older environments.
npm install vuex-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows setup with createCache plugin, dispatch, has, delete, and clear methods. Uses TypeScript syntax with Vuex Store.
Ensure payloads are primitive or consistently structured; consider wrapping payload in a string key if needed.
Do not pass timeout to createCache; manually manage cache expiration with store.cache.delete or clear.
Use createCache({ name: 'mycache' }) instead.Upgrade Vuex to version 2 or 3.
Use full path like 'moduleName/ACTION_NAME' when using namespaced modules.
Clone data before mutation if needed, or avoid mutating shared promises.
Add plugins: [createCache()] when creating the store.
Verify the action name string and ensure it matches a defined action in the store.
Access store.cache only after store creation, not inside module definitions.
Add Promise polyfill (e.g., @babel/polyfill) before vuex-cache.
Use `import createCache from 'vuex-cache'` (no curly braces).