{"_id":"@aadvdh/localstorage-cache","_rev":"2-a31d4a18955d43b0b35b6110dc1d50dc","name":"@aadvdh/localstorage-cache","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@aadvdh/localstorage-cache","version":"1.0.0","description":"A small package for using localstorage as a cache","main":"index.js","scripts":{"build":"babel src -d dist","test":"jest"},"author":{"name":"Aad van den Hoogenband"},"license":"MIT","devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/preset-env":"^7.14.5","jest":"^27.0.4"},"gitHead":"fe1e917bb7205ac1a59df9ecc2e73fa466ef4709","_id":"@aadvdh/localstorage-cache@1.0.0","_nodeVersion":"14.16.0","_npmVersion":"7.16.0","dist":{"integrity":"sha512-IIx7+sXZH998/VCA9kyui+3g0AKE0i6maHgShCdZhNwtIoI4SN601TlZ4xQlJ+g2dZud7CGuUQyU3+w635qKiQ==","shasum":"15a1dc9df418cea4f22e4229bb0b0cfce09c5b47","tarball":"https://registry.npmjs.org/@aadvdh/localstorage-cache/-/localstorage-cache-1.0.0.tgz","fileCount":7,"unpackedSize":16512,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgzPMECRA9TVsSAnZWagAAD2UP/R2PZiyRXKItp/SGo/Su\nS3o8E0u///ASwsQrhEe5KQq1xldCj5V1y8OcfO+GRzrUJ88w87pAX7kelNYl\nwLLeUQROnLP6NPMhJ+jp61VJZgrFG9lIdJNGAIJa/P2PYRK1Uht/YBORRmaz\nUiKWQTVU3rNDcj0Zsob/++z0jwrrhZ7luxETXxl5zYHpKKRKwwUpLHpEBrR1\nl0Eyp+ekNovFDGJRdub+ZQ+t7TWOl6Gq2fUqhnmlMwWgi6wbcuXzbRj4Z9CQ\no6H+Soh9vms3eVaVS1w3FwQ6rQDePajVEmRo+eYUaP6RlxOsWqhePeNinA1e\nDyx9Hq2qeT4T3pdi0NnKQ38SNzbgTKU52OnUm38yyxpirGW9HnFN4Mj4tMNa\np6x5s0hMyAuT0wsPNc4LgwsYxJ/njYy924AQ3jdjUJG5V7XijDkFgSNPHvNt\n9e3DMJClvbFkACX++I0nXh1Ujecx/B/VEBHqLAMfFHfH/fP88gKE3k5Ut9qz\n2jFu/tJwa4AoMv1Sq4dQ5KusLJwYn/fN9S+J/L+KV2h1ywxvDH3o1oAyMKLN\n1qUupaXL5mle76sZVQUH/Ms2/Q5DxLvxdVXHYHUNYjChk5TGkQl8hPPd/Cnz\nIBWdm637iiXnrhcKBAK0hkbldCssv+nErKMcW1xd82g3Re3iWXs9LaCX41Rg\n1ZNV\r\n=PzMU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCs+ZtmErNu7GstdJoUMV/9Ko+8ZrFV4hmYOmIFL9M7GAIgMukLhlM1js6OzO8YCs+EyEyoRtLfwCkxj5c7nod8Prg="}]},"_npmUser":{"name":"aadvdh","email":"vandenhoogenbandaad@gmail.com"},"directories":{},"maintainers":[{"name":"aadvdh","email":"vandenhoogenbandaad@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/localstorage-cache_1.0.0_1624044291650_0.7927761021887354"},"_hasShrinkwrap":false},"1.0.1":{"name":"@aadvdh/localstorage-cache","version":"1.0.1","description":"A small package for using localstorage as a cache","main":"index.js","scripts":{"build":"babel src -d dist","test":"jest"},"author":{"name":"Aad van den Hoogenband"},"license":"MIT","devDependencies":{"@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/preset-env":"^7.14.5","jest":"^27.0.4"},"gitHead":"63c3cb41fca9009d8e110448ec982e1f7a30bc2d","_id":"@aadvdh/localstorage-cache@1.0.1","_nodeVersion":"14.16.0","_npmVersion":"7.16.0","dist":{"integrity":"sha512-8U9a4u97N4nz9PJRN2pEqaxPwCFE8AAZttrFxrkzqiVJrvoUmQXRmkzouESMgNgVbfNH38Yw9RPyHbBB+5SuZw==","shasum":"6269a85c5d88f2799a174762542909b35848dd72","tarball":"https://registry.npmjs.org/@aadvdh/localstorage-cache/-/localstorage-cache-1.0.1.tgz","fileCount":8,"unpackedSize":16606,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgzPQACRA9TVsSAnZWagAA0gAP/AglJ2j4Hr9XI1u24eZK\nDFwGupzsurovEl5kvvjnQ2SVz7hvbaVqxx0G5DTKKsRIXAdsboeHMGMLN7JQ\nQWqh4C9EHF/lSnI1U01spfWqlm6UGwJHv5fJ6VnYyF9Euicvam7Q5Oqz3+gf\na/ZHnkZE9zPaZT2WnBWBhFKurJJGmtN3BQHSupXVYiHgU0ZnPEORpqCbulTP\nvHiToG3Ie4SL3e15txhwgQZk3nuph57NDZLjaqh42InM3+a280dUiIr/9pYE\ns/wXel+pjRwXl7TJVHaO4s1Oh0G1lwnjc2NQJoIfHuzlZ30xGpG7fH0caELh\nPt9KoOWzOnoHDmQ3wdZTcgdvYBqNSQgxPAnQkNIf56FLL5vXkOFVYIVxi7Gz\nCLYV/mKeY9KGoB+6HFkljOkYdiQVpukjgq93IRj6cHwHiFJcdB+GGP+rbxmb\nFvX9Twh5Ed7aniuaIiybU129VbBkkg3QxM0l6X7wOmRELysXnm1PUPBXcdEz\n0tRDY9iv1l4tLZRnMrQNBm3lwyKFoadbQuHyM5GjWDeuDM7bZJnUdpgVdaLz\nlsRJS4jB/5y1/OBgmFKhW6jkzKFrdlJhmqN/oUyGAWf51KHb6WOTfQ6eaqQ7\nP/QUAlKnEg61R9GHYoYZ3TGmiScjWCyV1/AANJmq1yggmtUK6dgtcFTNOqWJ\nGHh7\r\n=ElgP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCJKaKKpNZCEmcwcsHuwLQG/sB6gBXTz7659EEtXM67tQIhAK22L04taCxgfZzIGfKXNO05hwrV5vK2pKr0ZLTjo/TV"}]},"_npmUser":{"name":"aadvdh","email":"vandenhoogenbandaad@gmail.com"},"directories":{},"maintainers":[{"name":"aadvdh","email":"vandenhoogenbandaad@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/localstorage-cache_1.0.1_1624044543696_0.520497844423865"},"_hasShrinkwrap":false}},"time":{"created":"2021-06-18T19:24:51.564Z","1.0.0":"2021-06-18T19:24:51.777Z","modified":"2022-04-04T10:55:00.204Z","1.0.1":"2021-06-18T19:29:03.817Z"},"maintainers":[{"name":"aadvdh","email":"vandenhoogenbandaad@gmail.com"}],"description":"A small package for using localstorage as a cache","author":{"name":"Aad van den Hoogenband"},"license":"MIT","readme":"# localstorage-cache\n\nA small library to add caching capabilities to localStorage.\n\n## Install\n\n    npm install @aadvdh/localstorage-cache\n\n## How to use\n\n### _import the LocalStorageCache class_\n\n    import LocalStorageCache from 'localstorage-cache.js'\n\n### _Initialize a new instance_\n\n    let ls = new LocalStorageCache();\n\n**Arguments:**\ncacheExpiryTime - The amount of time to keep an item in the cache in seconds, standard at 3600 seconds, or 1 hour.\nprefix - a prefix added to every key. Standard value is \"lsc\"\n\n### _Add an item to the cache:_\n\n    ls.set(key,value,cacheExpiryTime);\n\nWill automatically clean up the cache incase the maximum storage size is exceeded.\nreturns true if succesful, false otherwise\n\n**Arguments:**\nkey - a key to retrieve the value by. Any non alphanumeric characters are stripped.\nvalue - the value to store. Can be any value\ncacheExpiryTime - in case you want to override the cacheExpiryTime.\n\n### _Retrieve an item from the cache:_\n\n    ls.get(key);\n\nreturns the value if it exists and the item hasn't expired yet. Null otherwise.\n\n**Arguments:**\nkey - the key of the value to be retrieved.\n\n### _setBucket:_\n\n    ls.setBucket(bucket);\n\nSet the bucketname to store the items in. All non alphanumeric characters are removed from the string.\n\n**Arguments:**\nbucket - name of the bucket to use\n\n### _Flush:_\n\n    ls.flush(expired);\n\nRemoves keys from storage without affecting all of the localStorage. If expired is set to false it will remove every key, otherwise it will only remove expired keys.\n\n**Arguments**\nexpired - Boolean value whether only expired items should be removed or all items.\n\n### _Flush bucket_\n\n    ls.flushBucket(expired, bucket)\n    Same as flush, but will only remove from a bucket.\n\n**Arguments:**\nexpired - Boolean value whether only expired items should be removed or all items.\nbucket - The bucket to remove from, otherwise it will use the bucket defined within the class.\n","readmeFilename":"README.md"}