{"_id":"@dzangolab/vuejs-cache","_rev":"5-87245b293470e9ac300c0086c7f34c66","name":"@dzangolab/vuejs-cache","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@dzangolab/vuejs-cache","version":"0.1.0","author":{"name":"Olivier Pichon","email":"op@dzango.com"},"license":"MIT","_id":"@dzangolab/vuejs-cache@0.1.0","maintainers":[{"name":"manandharsabir","email":"manandharsabir@hotmail.com"},{"name":"cpxpratik","email":"surajkrstha@gmail.com"},{"name":"rameshlohala","email":"ramesh@united-asian.com"},{"name":"uddhab","email":"uddhab@united-asian.com"},{"name":"opichon","email":"op@dzango.com"}],"homepage":"https://github.com/unitedasian/vuejs-cache","dist":{"shasum":"2cad326ebff9c41362457f673feb636be1c6a5f8","tarball":"https://registry.npmjs.org/@dzangolab/vuejs-cache/-/vuejs-cache-0.1.0.tgz","fileCount":19,"integrity":"sha512-IRZzkLERF7PcPqXBCy5gc5tpdyUkPpbC4whlXeh9OXAc7QcN+Ac3g5efn1+67sXSP0+/PqqOqMZ8PXSEIG6/PQ==","signatures":[{"sig":"MEUCIFw1+Yrn7BPz0o7wWAyM/gYq8w08NqkU84fxpjqNHg6XAiEAugQGzQiG3Vn8oyNqbwZ5hLk/FGcQt0nOYqb9R8xrOM8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":208451,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZyf3CRA9TVsSAnZWagAAiDsP/RWQdEDXCYGQDH1q8+49\nkX6JjtY2nZ7ux40jdbZCtDQKbWElnspqsdn/P5o9mu1I/AFIIHJ5xMwg7JNV\nw4qi1P5f1MflAesxCEoswMJkMoePFiSzpSw6JZx0C71uR3gyJEIADlTdnS9i\n6ZmXPvWObtrXduED1ElPFuq8+1Y/b7BviU9kghjefkx0VEIxOnPjSMUGGD1t\nJk7jOkqsqdpSJZAx5dwyk+28PRqwJO/FF/n8CFVO1sF/irLr49Q2QsAdIx9Q\nBj3vmT6PPJMBaPdMWI+0p3NS8ksWk9IWoik2AZmsOjjL3Xy/ucHmpOswZ6la\nPnloKyT88AawggXph5G57B1fjvXImNq9rn0fO8Al5CsdeLZBtUDZ0W5JY74j\nDVMwHZZF4VjsFdYQz99cy/Jv734mh7IxKfVY96G4rifY7m3y0JQ1IcYXgsDM\nNOgoAEK/Epr2yeT6lDrFXs2E6TnMHlZbL1m+Z8frXKhCgWip/CKNOSuR3SuX\n2qA9mrF29Ivk1hMyYGmb6xeVweaQC9E0wwOGDtGUuEAMFI33IAF7dVD6IfUZ\nzzJ9LdkWVdmNV0ZwyA8huM6roME0wxBIBdf6pgvVJy7aZWRcp3Wpmo7dXTN2\ngx0ah1EXYb4koy8xTkZLqZnLo481sr5cje+IQG6FMIv/Bvxe2IMiuYMr5Bzr\nSaWe\r\n=CDV+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","gitHead":"9d0b8542e2ead0ecbbaa03cd1a9e24b6820290c8","scripts":{"dev":"rm -rf ./dist/* && webpack --colors --hide-modules","fix":"eslint --ext .js src --fix","lint":"eslint --ext .js src","build":"rm -rf ./dist/* && NODE_ENV=production webpack --colors --hide-modules"},"_npmUser":{"name":"manandharsabir","email":"manandharsabir@hotmail.com"},"_npmVersion":"5.6.0","description":"Vuejs cache plugin","directories":{},"_nodeVersion":"9.11.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^4.19.1","webpack":"^3.11.0","babel-core":"^6.26.0","babel-eslint":"^8.2.2","babel-loader":"^7.1.4","eslint-loader":"^2.0.0","webpack-merge":"^4.1.2","babel-preset-env":"^1.6.1","eslint-plugin-node":"^6.0.1","babel-preset-stage-2":"^6.24.1","eslint-plugin-import":"^2.11.0","eslint-plugin-promise":"^3.7.0","eslint-config-standard":"^11.0.0","eslint-plugin-standard":"^3.0.1","eslint-friendly-formatter":"^4.0.1","babel-plugin-transform-runtime":"^6.23.0"},"peerDependencies":{"vue":"^2.5.16","vuex":"^3.0.1","pouchdb-browser":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/vuejs-cache_0.1.0_1583818743155_0.3271261877462428","host":"s3://npm-registry-packages"}}},"time":{"created":"2020-03-10T05:39:02.928Z","modified":"2026-08-20T10:53:18.681Z","0.1.0":"2020-03-10T05:39:03.326Z"},"author":{"name":"Olivier Pichon","email":"op@dzango.com"},"license":"MIT","homepage":"https://github.com/unitedasian/vuejs-cache","description":"Vuejs cache plugin","maintainers":[{"email":"op@dzango.com","name":"opichon"},{"email":"uddhab@united-asian.com","name":"uddhab"}],"readme":"# Vuejs cache plugin\n\n## Installation\n\n### via npm\n\n```bash\nnpm install @dzangolab/vuejs-cache\n```\n\n### via yarn\n\n```bash\nyarn add @dzangolab/vuejs-cache\n```\n## Requirements\n\nThis package need following packages installed in your app\n\n  - pouchdb-browser@^7.0.0\n  - vue@^2.5.16\n  - vuex@^3.0.1\n\n### Api requirements\n\nYour api needs to attach a custom header for db version, the cache data is updated based on this version.\n\nCustom header have `json` key and value pair. key is based on `cacheKey` and value is db version.\n\n```json\n{\"cacheKey1\": 898999, \"cacheKey2\": 48383}\n```\n\n## Usage\n\nInstall Vuejs cache plugin as follows:\n\n```js\n# main.js\n\nimport cachePlugin from '@dzangolab/vuejs-cache'\n\nVue.use(cachePlugin, {options})\n\n```\n\n### Options\n\n| Option                 | Description                                              | Type            | Required | Default             |\n|:-----------------------|:---------------------------------------------------------|:----------------|:---------|:--------------------|\n| store                  | Main store to which the cache module is attached to      | Object          | true     |                     |\n| axios                  | The instance of axios used by app                        | Object          | true     |                     |\n| userId                 | Currently logged in user's id                            | Integer/String  | false    | null                |\n| databaseName           | Name of the cache db                                     | String          | false    | _cache              |\n| storeModuleName        | store module name                                        | String          | false    | cache               |\n| dbVersionsHeaderKey    | Custom response header key for db version                | String          | true     |                     |\n| cacheConfigs           | array value to handle route, db header key, name         | array           | true     |                     |\n| ignoreRoutes           | array of route to ignore for cache fetch                 | array           | false    | []                  |\n\ncacheConfigs example\n ```js\n \n [{cacheKey: 'cacheKey_name', cacheRoute: 'cache_route', isCacheRoutePublic: false}]\n \n ````\n\nOnce you have registered the plugin. It attaches a `cache` or the `{storeModuleName}` module to the store, The cached data received from the cacheRoute can be accessed as\n. All store and getters created based on `cacheKey`\n\n### using store\nassuming you have not updated the storeModuleName\n \n```js\n\nstore.cache.<cacheKey>\n```\nOr\n\n```js\n\nstore.cache[<cacheKey>]\n```\n\n### use getters\n\n```js\n# File.vue\n\n// ..\n// ..\nthis.$store.getters['cache/cacheKey_name']\n\n```\n## Changing user id\nThe store has a action to change the user id. Most probably after a login you need to change the user id for the cache\n\n```js\n// ..\n// ..\n\nthis.$store.dispatch('cache/updateCachedUserId', id)\n\n```\n\n## Displaying message to users when updating cache\n\nThe cache module has a getter `updatingCache` that is true when the data is being fetched from the server.\n\nyou can use the getter to add visual clues about ongoing update.\n\n## Resetting cache\nThe store has a action reset the cache\n\n```js\n// ..\n// ..\n\nthis.$store.dispatch('cache/reset')\n\n```\n\n## Making sure you app is mounted after the cache is available\n\n```js\n// main.js\n\n// ..\n// ..\n\nVue._cacheInitialized\n  .then(() => {\n    new Vue({\n      el: '#app',\n      store\n    })\n  })\n```\n","readmeFilename":"Readme.md"}