{"_id":"bluebird-lru-cache","_rev":"28-fa33125967ff521b4b289c02ea4aa008","name":"bluebird-lru-cache","dist-tags":{"latest":"1.0.1"},"versions":{"0.1.0":{"name":"bluebird-lru-cache","version":"0.1.0","author":"","license":"","_id":"bluebird-lru-cache@0.1.0","maintainers":[{"name":"page","email":"page@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"d911558f1227d7e870ee73c2b2faec8f41a1942f","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-0.1.0.tgz","integrity":"sha512-mfyRs4vOhTw0RAYbtPSTBPsB7tjj5uuTYfpQceCvtFy1iMzHrXh3EQCR8dIkE7E2fZa79NaDS03kBj1+wTsVBw==","signatures":[{"sig":"MEMCHxgrEfK6zipkO4TV0PeBrhyv2vkgVnwt3MqSP0XhjL4CIDWZ0ZieJFonrfv+csCFvLkPUpCymnU/JIb+QQeGu8uQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"d911558f1227d7e870ee73c2b2faec8f41a1942f","scripts":{"test":"node node_modules/coffee-script/bin/coffee -c . && node node_modules/mocha/bin/mocha"},"_npmUser":{"name":"page","email":"page@resin.io"},"repository":{"url":"https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"1.4.9","description":"<a href=\"http://promisesaplus.com/\">\r     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\r </a>","directories":{},"dependencies":{"bluebird":"~2.2.2","lru-cache":"~2.5.0","chai-as-promised":"~4.1.1"},"devDependencies":{"chai":"~1.9.0","mocha":"~1.21.3","coffee-script":"~1.7.1"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"0.1.1":{"name":"bluebird-lru-cache","version":"0.1.1","author":"","license":"","_id":"bluebird-lru-cache@0.1.1","maintainers":[{"name":"page","email":"page@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"f07146df91e8a0141a03f0312b19a65a51428c0f","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-0.1.1.tgz","integrity":"sha512-bZTejFI/o331pheslIXK2kvtO9IDQUuD2+yrcLf0u8gKd3cwTCesKH2HA3BZ2DXmBn3Jqc6T0yuXIYF6KL9qRw==","signatures":[{"sig":"MEUCIQCPc5vwoAuZSwpJOFk6v+kBPKaOzaCqDh7orNogqtmYCAIgD6eE84hgqTDJEFa/mNi7aU+KWWTucBjfNlqzzsPpACk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"f07146df91e8a0141a03f0312b19a65a51428c0f","scripts":{"test":"node node_modules/coffee-script/bin/coffee -c . && node node_modules/mocha/bin/mocha"},"_npmUser":{"name":"page","email":"page@resin.io"},"repository":{"url":"https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"1.4.9","description":"<a href=\"http://promisesaplus.com/\">\r     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\r </a>","directories":{},"dependencies":{"bluebird":"~2.2.2","lru-cache":"~2.5.0","typed-error":"~0.1.0"},"devDependencies":{"chai":"~1.9.0","mocha":"~1.21.3","coffee-script":"~1.7.1","chai-as-promised":"~4.1.1"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"0.1.2":{"name":"bluebird-lru-cache","version":"0.1.2","author":"","license":"","_id":"bluebird-lru-cache@0.1.2","maintainers":[{"name":"page","email":"page@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"3468d7ea529cb61aed1c51620e44c8f8edb57d99","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-0.1.2.tgz","integrity":"sha512-rQMlR0sJiW1RQKevOnXNOSsIFb/uaDJ0u10yvhH40v5GNtfhKNaLQ+qiYN5xpuKz3sprch0rEn7bQQsbGZSyWQ==","signatures":[{"sig":"MEQCIFjGsz0sQrFuO2PzHnPBoaKViUMUbA42FW8Ogr12tDTWAiANzUcDq9VPvC8JBGe36cyiGkMlEF8L/qnjhVIQ0SeZAA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"3468d7ea529cb61aed1c51620e44c8f8edb57d99","gitHead":"970182b241147e0dcb454fcf6578dc087e196c62","scripts":{"test":"node node_modules/coffee-script/bin/coffee -c . && node node_modules/mocha/bin/mocha"},"_npmUser":{"name":"page","email":"page@resin.io"},"repository":{"url":"https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"1.4.23","description":"<a href=\"http://promisesaplus.com/\">\r     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\r </a>","directories":{},"dependencies":{"bluebird":"~2.3.11","lru-cache":"~2.5.0","typed-error":"~0.1.0"},"devDependencies":{"chai":"~1.9.0","mocha":"~1.21.3","coffee-script":"~1.7.1","chai-as-promised":"~4.1.1"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"0.1.3":{"name":"bluebird-lru-cache","version":"0.1.3","author":"","license":"","_id":"bluebird-lru-cache@0.1.3","maintainers":[{"name":"page","email":"page@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"1e67bee96e4d52186ef7fb5e3c4ab9e8a54367f4","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-0.1.3.tgz","integrity":"sha512-vYHdYo7r2QyOBEPxigc3XQ7IH11wQmAVKqIodsPQ5dsXnVM0s1iExTWMDZUdqvjpHma5EsQGnjToOq/B577WpA==","signatures":[{"sig":"MEQCICvx97/490zi0bpzjSKJrjByyV8z17LqsFmRfBn0guHtAiAA2ncbhQD2F33gdxN1QygxMJ8F7KfwI54AVHYoQylvaQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"1e67bee96e4d52186ef7fb5e3c4ab9e8a54367f4","gitHead":"b17e97e576f95f0a2f107d46e0cef1879cb78d85","scripts":{"test":"node node_modules/coffee-script/bin/coffee -c . && node node_modules/mocha/bin/mocha"},"_npmUser":{"name":"page","email":"page@resin.io"},"repository":{"url":"https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"1.4.23","description":"<a href=\"http://promisesaplus.com/\">\r     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\r </a>","directories":{},"dependencies":{"bluebird":"^2.7.1","lru-cache":"~2.5.0","typed-error":"~0.1.0"},"devDependencies":{"chai":"~1.9.0","mocha":"~1.21.3","coffee-script":"~1.7.1","chai-as-promised":"~4.1.1"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"0.1.4":{"name":"bluebird-lru-cache","version":"0.1.4","author":"","license":"","_id":"bluebird-lru-cache@0.1.4","maintainers":[{"name":"page","email":"page@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache#readme","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"7aea07504b9fae64336ea068134032297f997162","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-0.1.4.tgz","integrity":"sha512-O6PrvMRZmtCQh/mtgFxkuaEpOZhU1xrT9JngeTTCghMCRjrFIqtkeT122oJGrxWojAQ5jmcBaOre5YzeHNFeUw==","signatures":[{"sig":"MEUCIAEVGRv6QPHNzgIvur5wXTU3VeFHpFlCWzm0Bu07z3OIAiEAmSvxgVRQZMSAR/8e1a+SzJ/nfWmjCB3dyGpfH/m6z0w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"7aea07504b9fae64336ea068134032297f997162","gitHead":"1d67b934e6057ad5f1e75412b4f94bc4936bcff2","scripts":{"test":"node node_modules/coffee-script/bin/coffee -c . && node node_modules/mocha/bin/mocha"},"_npmUser":{"name":"page","email":"page@resin.io"},"repository":{"url":"git+https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"2.9.1","description":"<a href=\"http://promisesaplus.com/\">\r     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\r </a>","directories":{},"_nodeVersion":"0.12.2","dependencies":{"bluebird":"^2.7.1","lru-cache":"^2.6.3","typed-error":"~0.1.0"},"devDependencies":{"chai":"^2.3.0","mocha":"^2.2.5","coffee-script":"~1.9.2","chai-as-promised":"^5.0.0"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"1.0.0":{"name":"bluebird-lru-cache","version":"1.0.0","author":"","license":"","_id":"bluebird-lru-cache@1.0.0","maintainers":[{"name":"page","email":"page@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache#readme","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"808acdb11b2f2094c38a40ea5b788b0caccb3c91","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-1.0.0.tgz","integrity":"sha512-L7OHMCzp5mGv7EkGfXtYzpCdDyX+wlp3TZIlTc0GDFtAf8VTg5beflxbLQrFx+FRPDTL86MlJeVOHhdwTrec1w==","signatures":[{"sig":"MEYCIQDyr2DIbXGIU5EqKHmqvylIKvjhsR1KdQwicZQ0RsQHfgIhAPOmHPJN04vyDzUscowNfijMSbpf/e2hrtq0ztEwCRVo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"808acdb11b2f2094c38a40ea5b788b0caccb3c91","gitHead":"99e8fa45521b8508a682266741dadc713ea67799","scripts":{"test":"node node_modules/coffee-script/bin/coffee -c . && node node_modules/mocha/bin/mocha"},"_npmUser":{"name":"page","email":"page@resin.io"},"repository":{"url":"git+https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"3.5.1","description":"<a href=\"http://promisesaplus.com/\">\r     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\r </a>","directories":{},"_nodeVersion":"5.0.0","dependencies":{"bluebird":"^3.0.6","lru-cache":"^3.2.0","typed-error":"~0.1.0"},"devDependencies":{"chai":"^3.4.1","mocha":"^2.2.5","coffee-script":"~1.10.0","chai-as-promised":"^5.0.0"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"0.0.2-update-typed-error-cca6e4aa8015d5e2c1d73cca1072c497dcd4c377":{"name":"bluebird-lru-cache","version":"0.0.2-update-typed-error-cca6e4aa8015d5e2c1d73cca1072c497dcd4c377","author":"","license":"","_id":"bluebird-lru-cache@0.0.2-update-typed-error-cca6e4aa8015d5e2c1d73cca1072c497dcd4c377","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"page","email":"page@resin.io"},{"name":"resin-ci","email":"accounts+npm-ci@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache#readme","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"24ec570ce5c7d72e010e66c03b6ea16741c9d7bf","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-0.0.2-update-typed-error-cca6e4aa8015d5e2c1d73cca1072c497dcd4c377.tgz","fileCount":7,"integrity":"sha512-vHGwm9+8kLUYZpI/dwLtVVpOguLLLYR+d2P6Z0ddS7mKg66nHQDlIq8eK0CYdrb4QCMf7X5XqW5D1lOQNmsoBw==","signatures":[{"sig":"MEUCICYewd3rDkdp2ffGalNqLwdl+Hb9oEqJHOy5WD+HYJKSAiEAlMIOS1A4Ikc9yy9g1OMotKAZuye4Cvak0fDxuVkn0sY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24187,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4bpnCRA9TVsSAnZWagAA0t0P+QFxeogPxKbWyQX2rnj7\nll/nJc6noVbZt8o+GOWEtIfkrb0UNMbDNDTmQIbjwmXYMgaCbTFB/JjxPs/b\nFHCMqRwSAstEAJ2US9TKbf6/QwcyjI/AaUx0lLJkj6FNVT9rKSRUOYHNXVnF\nBd1bjhDr5ZVADEHPgrNn2DYJvGxHMdLNPHFhOU6cMw7rrb69mw78Fymv7+5J\nuyCIm9dxemLzVXSFRGwpO1egTKpsibIWD6SeTuelb7K6shwLTUK5IXC3A5YE\nm2lmw22XBMi7XHeDS9inIJRBfey+H7YnaVECk+FDqMaTTHGto5CbNZfQrBpP\nCFp3/aAssBfvFNiVIywDOLuGQaMBp3vbGiTnvtI2ExpHdB5/GgqMzhSpR8q0\naO37CMijeKdeM3VY6XPTonZsaLgmNxldufkDJEicxLzTDTBGjS7D1oPV6H0B\ntzJYERDcSsUdi5xWA5mpQphLvUIu4SSrIcGRnwzbrcs2Pf5D1FgJfskBzpbp\nS5UogNUbjHMM2wqn2lkBeBy3xO6E+aRotLvpWWq6AVOiQmZ2TrYvjJbmMzoF\n3vYiIlYYYXkbptYzjWu2OuhOWfcfeMaudoXx+1jR4yPC1Rs9IQZMBFz2G+ZZ\notK1hUeKfeEeaanumJh/aN13ipfSdahxNIw25gNWeZbnxvTieC5u98LpbG1P\nVMU6\r\n=KIlO\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"<a href=\"http://promisesaplus.com/\">\n    <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\n</a>\n\nbluebird-lru-cache\n=========\n\nIn-memory, Promises/A+ [lru-cache](https://github.com/isaacs/node-lru-cache) via [bluebird](https://github.com/petkaantonov/bluebird), inspired by [bluecache](https://github.com/kurttheviking/bluecache)\n\n\n### Motivation\n\nAllow easy use of LRU-Cache within a promise architecture, both accepting and returning promises.\n\n\n### Usage\n\n```\nvar BluebirdLRU = require(\"bluebird-lru-cache\");\nvar options = {\n  max: 500,\n  maxAge: 1000 * 60 * 60\n};\n\nvar cache = BluebirdLRU(options);\n\ncache.set(\"key\", \"value\")\n.then(function () {\n\treturn cache.get(\"key\")\n})\n.then(function (value) {\n\tconsole.log(value);  // \"value\"\n});\n```\n\n\n### Options\n\nOptions are passed directly to LRU Cache at instantiation; the below documentation is based on the API descriptions of the underlying LRU Cache:\n\n- `max`: The maximum size of the cache, checked by applying the length function to all values in the cache\n- `maxAge`: Maximum age in ms; lazily enforced; expired keys will return `undefined`\n- `length`: Function called to calculate the length of stored items (e.g. `function(n) { return n.length; }`); defaults to `function(n) { return 1; }`\n- `dispose`: Function called on items immediately before they are dropped from the cache. Called with parameters (`key`, `value`)\n- `stale`: Allow the cache to return the stale (expired via `MaxAge`) value before deleting it\n- `noreject`: _bluebird-lru-cache only_; Boolean; instructs bluebird-lru-cache not to generate rejected promises and instead resolve to undefined for missing or expired output from `get` and `peek`;  defaults to `false`\n- `fetchFn`: _bluebird-lru-cache only_; Function; instructs bluebird-lru-cache to use this function to fetch and store data using this function if it does not already exist in the cache, instead of returning a rejection or `undefined`\n\n\n### API\n\nAny of the arguments for these functions can be a promise, which will be resolved before executing the method.\n\n**`set(key, value, max)`**\n\nSet the given `key` in the cache to `value`; updates the \"recently-used\"-ness of the key; returns a promise that resolves to a boolean indicating whether the value was stored or not (in the case of the value being too large it will not be stored).  \n`max` is optional and overrides the cache `max` option if provided.\n\n```\nvar promisedKey = Promise.resolved().delay(500).then(function () {\n\treturn 'foo';\n});\nvar promisedValue = Promise.resolved().delay(500).then(function () {\n\treturn 'bar';\n});\n\ncache.set(promisedKey, promisedValue).then(function (cached) {\n\tconsole.log(cached);  // => true\n});\n```\n\n\n**get(key)**\n\nReturns a promise that resolves to the cached value of `key`; updates the \"recently-used\"-ness of the key.\n\nIn the case of the key not existing, the Promise will be rejected with a `BluebirdLRU.NoSuchKeyError`, with a `key` property that resolves to the key that could not be found.\n\n\n**peek(key)**\n\nReturns a promise that resolves to the cached value of `key` _without_ updating the \"recently-used\"-ness of the key.\n\nIn the case of the key not existing, the Promise will be rejected with a `BluebirdLRU.NoSuchKeyError`, with a `key` property that resolves to the key that could not be found.\n\n\n**del(key)**\n\nReturns a promise that resolves to `undefined` after deleting the key from the cache.\n\n\n**reset()**\n\nReturns a promise that resolves to `undefined` after removing the key from the cache.\n\n\n**has(key)**\n\nReturns a promise that resolves to either `true` or `false` without updating the \"recently-used\"-ness; does not impact the use of `stale` data.\n\n\n**forEach(function(value,key,cache), [thisp])**\n\nJust like `Array.prototype.forEach`.  Iterates over all the keys in the cache, in order of recent-ness.  (Ie, more recently used items are iterated over first.)\n\n\n**keys()**\n\nReturns a promise that resolves to an array of the keys in the cache.\n\n```\ncache.keys().then(function (keys) {\n\tconsole.log(keys);\n});\n```\n\n**values()**\n\nReturns a promise that resolves to an array of the values in the cache.\n\n```\ncache.values().then(function (values) {\n\tconsole.log(values);\n});\n```\n\n**length()**\n\nReturn total length of objects in cache taking into account `length` options function.\n\n**itemCount()**\n\nReturn total quantity of objects currently in cache. Note, that `stale` (see options) items are returned as part of this item count.\n\n### Rejection handling\n\nBy default BluebirdLRU returns a rejected promise for get/peek operations that fail, as such:\n\n```\nvar BluebirdLRU = require('bluebird-lru-cache');\n\nvar cache = BluebirdLRU();\n\ncache.get('foo').catch(BluebirdLRU.NoSuchKeyError, function (err) {\n\tconsole.log('Could not find key:', err.key); // => \"Could not find key: foo\"\n});\n```\n\nyou can disable this with the `noreject` option:\n\n```\nvar BluebirdLRU = require('bluebird-lru-cache');\n\nvar cache = BluebirdLRU({\n  noreject: true\n});\n\ncache.get('foo').then(function (value) {\n\tif (value === undefined) {\n\t\tconsole.log('Could not find key'); // => \"Could not find key\"\n\t}\n});\n```\n\n### Contribute\n\nPRs are welcome! For bugs, please include a failing test which passes when your PR is applied.\n","gitHead":"cca6e4aa8015d5e2c1d73cca1072c497dcd4c377","scripts":{"test":"npm run prepare && mocha --require coffeescript/register test/**/*.coffee","prepare":"coffee -c index.coffee"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"6.1.0","description":"<a href=\"http://promisesaplus.com/\">     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" /> </a>","directories":{},"_nodeVersion":"10.4.0","dependencies":{"bluebird":"^3.0.6","lru-cache":"^3.2.0","typed-error":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0","coffeescript":"^1.12.7","chai-as-promised":"^7.1.1"},"_npmOperationalInternal":{"tmp":"tmp/bluebird-lru-cache_0.0.2-update-typed-error-cca6e4aa8015d5e2c1d73cca1072c497dcd4c377_1541519974553_0.49546870360174844","host":"s3://npm-registry-packages"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"1.0.1-update-typed-error-16bded9e6c79cd2dab0658e3898d8c7593a44499":{"name":"bluebird-lru-cache","version":"1.0.1-update-typed-error-16bded9e6c79cd2dab0658e3898d8c7593a44499","author":"","license":"","_id":"bluebird-lru-cache@1.0.1-update-typed-error-16bded9e6c79cd2dab0658e3898d8c7593a44499","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"page","email":"page@resin.io"},{"name":"resin-ci","email":"accounts+npm-ci@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache#readme","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"25fccae68cb95753b3512215fd625613c800467a","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-1.0.1-update-typed-error-16bded9e6c79cd2dab0658e3898d8c7593a44499.tgz","fileCount":7,"integrity":"sha512-GllX7SRzlft5t3nILwJHIKdUeGgzTTm/uHjTkLnUyPjU8gJR3fYZ/aDuw7AhFlAv7Od6NmEY2IGAdYL5p8O61w==","signatures":[{"sig":"MEQCICKB7K/prGIK0D2xehbWSXmdfs/49qnRsIlV7Rbs63+GAiAhxqN1SpmFzSvrpDS2G25KHcrizAdeTwy81j13+rEkkg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24436,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4cZRCRA9TVsSAnZWagAAVpAP/RtkUIDHVQ1rtuNjbT2h\nL4TWwUnF5dnhlh5YwMgXvJV/9wG27Uv5x2l6umTCEAzb9O9VevzmeiiJYIqJ\nwmjEbCadPoB3ofWTP6ztfvcBKzZtsvMUNbA3tQBpYTGKCWois/q5IdL2ioz2\nEoZ50H5OmUC6nRm2izLtFg32yNXOdIGepW1DClrqdwsJd5JwIKbCGS9cJ0uy\nk0O2G7oNNLfNcYhfsvY7Pf3ORtV6Fxv7eHpXaY82bBxbiFDbFT4gbrE4Fixc\nlC2/fRq0rr4K7kHpJT9B1Bx0TDKpC6req0sv3K0cXuulpPPrMtGK16CvYe25\nkvxBNSzig61sahrhfMY3tK6LvPblgdUuw7mvPpzziuKs22Fi5MDte0+YB5MP\ncB7SeGftZQblbHUOtQ/NBd/YFtzYUuuuyT0/KTAMBRmTHMT8XIRXRHDXfa2i\n0xZCAPoT1hRWDSCtT8HZlgjG6gNwkDvwL5mMI+4st+w+xOGczDMvb3ExBDX6\n+EdljSgLd0GTTIW45MnfNur16VzJ38ru7RXp21LwKl8HQMEzLmaVOS+el1eW\nGt5EErlWFO+Pami5Ijtian3Nh1reJcQlZP29MqTFwWOSdYuhLH2I7X/UJPXf\niUsWt5wA81FgMFvJcZ8RFWVPE6l63iSasNCsTJWv1OdBoUuPKignTcv3Ro7S\n3Iht\r\n=0TjG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","readme":"<a href=\"http://promisesaplus.com/\">\n    <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\n</a>\n\nbluebird-lru-cache\n=========\n\nIn-memory, Promises/A+ [lru-cache](https://github.com/isaacs/node-lru-cache) via [bluebird](https://github.com/petkaantonov/bluebird), inspired by [bluecache](https://github.com/kurttheviking/bluecache)\n\n\n### Motivation\n\nAllow easy use of LRU-Cache within a promise architecture, both accepting and returning promises.\n\n\n### Usage\n\n```\nvar BluebirdLRU = require(\"bluebird-lru-cache\");\nvar options = {\n  max: 500,\n  maxAge: 1000 * 60 * 60\n};\n\nvar cache = BluebirdLRU(options);\n\ncache.set(\"key\", \"value\")\n.then(function () {\n\treturn cache.get(\"key\")\n})\n.then(function (value) {\n\tconsole.log(value);  // \"value\"\n});\n```\n\n\n### Options\n\nOptions are passed directly to LRU Cache at instantiation; the below documentation is based on the API descriptions of the underlying LRU Cache:\n\n- `max`: The maximum size of the cache, checked by applying the length function to all values in the cache\n- `maxAge`: Maximum age in ms; lazily enforced; expired keys will return `undefined`\n- `length`: Function called to calculate the length of stored items (e.g. `function(n) { return n.length; }`); defaults to `function(n) { return 1; }`\n- `dispose`: Function called on items immediately before they are dropped from the cache. Called with parameters (`key`, `value`)\n- `stale`: Allow the cache to return the stale (expired via `MaxAge`) value before deleting it\n- `noreject`: _bluebird-lru-cache only_; Boolean; instructs bluebird-lru-cache not to generate rejected promises and instead resolve to undefined for missing or expired output from `get` and `peek`;  defaults to `false`\n- `fetchFn`: _bluebird-lru-cache only_; Function; instructs bluebird-lru-cache to use this function to fetch and store data using this function if it does not already exist in the cache, instead of returning a rejection or `undefined`\n\n\n### API\n\nAny of the arguments for these functions can be a promise, which will be resolved before executing the method.\n\n**`set(key, value, max)`**\n\nSet the given `key` in the cache to `value`; updates the \"recently-used\"-ness of the key; returns a promise that resolves to a boolean indicating whether the value was stored or not (in the case of the value being too large it will not be stored).  \n`max` is optional and overrides the cache `max` option if provided.\n\n```\nvar promisedKey = Promise.resolved().delay(500).then(function () {\n\treturn 'foo';\n});\nvar promisedValue = Promise.resolved().delay(500).then(function () {\n\treturn 'bar';\n});\n\ncache.set(promisedKey, promisedValue).then(function (cached) {\n\tconsole.log(cached);  // => true\n});\n```\n\n\n**get(key)**\n\nReturns a promise that resolves to the cached value of `key`; updates the \"recently-used\"-ness of the key.\n\nIn the case of the key not existing, the Promise will be rejected with a `BluebirdLRU.NoSuchKeyError`, with a `key` property that resolves to the key that could not be found.\n\n\n**peek(key)**\n\nReturns a promise that resolves to the cached value of `key` _without_ updating the \"recently-used\"-ness of the key.\n\nIn the case of the key not existing, the Promise will be rejected with a `BluebirdLRU.NoSuchKeyError`, with a `key` property that resolves to the key that could not be found.\n\n\n**del(key)**\n\nReturns a promise that resolves to `undefined` after deleting the key from the cache.\n\n\n**reset()**\n\nReturns a promise that resolves to `undefined` after removing the key from the cache.\n\n\n**has(key)**\n\nReturns a promise that resolves to either `true` or `false` without updating the \"recently-used\"-ness; does not impact the use of `stale` data.\n\n\n**forEach(function(value,key,cache), [thisp])**\n\nJust like `Array.prototype.forEach`.  Iterates over all the keys in the cache, in order of recent-ness.  (Ie, more recently used items are iterated over first.)\n\n\n**keys()**\n\nReturns a promise that resolves to an array of the keys in the cache.\n\n```\ncache.keys().then(function (keys) {\n\tconsole.log(keys);\n});\n```\n\n**values()**\n\nReturns a promise that resolves to an array of the values in the cache.\n\n```\ncache.values().then(function (values) {\n\tconsole.log(values);\n});\n```\n\n**length()**\n\nReturn total length of objects in cache taking into account `length` options function.\n\n**itemCount()**\n\nReturn total quantity of objects currently in cache. Note, that `stale` (see options) items are returned as part of this item count.\n\n### Rejection handling\n\nBy default BluebirdLRU returns a rejected promise for get/peek operations that fail, as such:\n\n```\nvar BluebirdLRU = require('bluebird-lru-cache');\n\nvar cache = BluebirdLRU();\n\ncache.get('foo').catch(BluebirdLRU.NoSuchKeyError, function (err) {\n\tconsole.log('Could not find key:', err.key); // => \"Could not find key: foo\"\n});\n```\n\nyou can disable this with the `noreject` option:\n\n```\nvar BluebirdLRU = require('bluebird-lru-cache');\n\nvar cache = BluebirdLRU({\n  noreject: true\n});\n\ncache.get('foo').then(function (value) {\n\tif (value === undefined) {\n\t\tconsole.log('Could not find key'); // => \"Could not find key\"\n\t}\n});\n```\n\n### Contribute\n\nPRs are welcome! For bugs, please include a failing test which passes when your PR is applied.\n","gitHead":"16bded9e6c79cd2dab0658e3898d8c7593a44499","scripts":{"test":"npm run prepare && mocha --require coffeescript/register test/**/*.coffee","prepare":"coffee -c index.coffee"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"6.1.0","description":"<a href=\"http://promisesaplus.com/\">     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" /> </a>","directories":{},"_nodeVersion":"10.4.0","dependencies":{"bluebird":"^3.0.6","lru-cache":"^3.2.0","typed-error":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0","coffeescript":"^1.12.7","chai-as-promised":"^7.1.1"},"_npmOperationalInternal":{"tmp":"tmp/bluebird-lru-cache_1.0.1-update-typed-error-16bded9e6c79cd2dab0658e3898d8c7593a44499_1541523024553_0.3391951690383723","host":"s3://npm-registry-packages"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."},"1.0.1":{"name":"bluebird-lru-cache","version":"1.0.1","author":"","license":"","_id":"bluebird-lru-cache@1.0.1","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"page","email":"page@resin.io"},{"name":"resin-ci","email":"accounts+npm-ci@resin.io"}],"homepage":"https://github.com/resin-io/bluebird-lru-cache#readme","bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"dist":{"shasum":"83b7295c96e3fef7e4fcf965e2b111d4e90c52da","tarball":"https://registry.npmjs.org/bluebird-lru-cache/-/bluebird-lru-cache-1.0.1.tgz","fileCount":7,"integrity":"sha512-HdQ6UO5vSXG5qK/pE9srZTHCsvRzmzrn7g31XTcKq9JWMK0PG+LJ0mmR6LIYuXO5DeiR+DnLWMnMsYcd0WD2Bg==","signatures":[{"sig":"MEUCIBNsIukj9EjYWawVkShkGXdHw50hXBrPZqEd6aT89fEdAiEA9SJD2iH/jH7EyRVIUgYeDCKSwsNC7d743J8Z4q9vWeU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24376,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4co5CRA9TVsSAnZWagAAUqAP/2pNR2jCXVSGsYce+UHQ\njNKeGQ+xPDDotKgTrOyetfVQ2DFCGGPhfAxWHjBPwlDcuNjUCg5k3xrAfNQC\nIgfdEbjI1Fzo9cRsW25NN9DfEXXptvaC4CGpC//PXSjTbZ14Il/x3IJ3a0DE\nY6LFyv700lMezUe7UnN4bvmX2tApUfdxyexAtU5TarnGDA2MHEtf/yPW5mo0\nf7HNKbY+4oqoOBHK9c+jfV9E+CVDOoHvRnigeKidRw7c4mDCFDgQgdJVmYso\nEnT4lZBcuvRMfgjl0gTTtP4b7xQR8Ec+S4JqRuvT1NjCL+KA2RaqEvUwZD4O\n40i85RroJPai1jRV7AYyRZaK7s4txUZ7TmpZVmSje4ndRRXgcwIPtiR+EOn4\nNG6wjD/+wznD5qqo/v/WLk/fJ35+EfyWcQne9e7PpxRASW57pRghjSNi7kD8\nE1/SZAdwmysQ1Fuxe8yEkQZgeJq9yNIL+jOPcXCXhYXRfXrXtIezbM5F3vGR\ng6jVoxoVAYFx5yxHpBR7EX0dedg+DRrkZzJqEcXVw+qWrCwKMYIYlefv0wjq\n3P2MS4EKduABR1yME9U1QG1u0sryK6qPH7wi8msta60T4Gz7BeuJBNiHsadT\nJ5hxl5RuycT0OEY/NRe6oRF9kzSKYXsgcZv+u275osOwi5Jd2hQXKObAQPLR\nSl6X\r\n=GkU5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"9a49e17b8aeaf963cd065fd79c2cb1e6cd57894d","scripts":{"test":"npm run prepare && mocha --require coffeescript/register test/**/*.coffee","prepare":"coffee -c index.coffee"},"_npmUser":{"name":"balena.io","email":"accounts+npm@balena.io"},"repository":{"url":"git+https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"_npmVersion":"6.1.0","description":"<a href=\"http://promisesaplus.com/\">     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" /> </a>","directories":{},"_nodeVersion":"10.4.0","dependencies":{"bluebird":"^3.0.6","lru-cache":"^3.2.0","typed-error":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","mocha":"^5.2.0","coffeescript":"^1.12.7","chai-as-promised":"^7.1.1"},"_npmOperationalInternal":{"tmp":"tmp/bluebird-lru-cache_1.0.1_1541524024567_0.13532835949959465","host":"s3://npm-registry-packages"},"deprecated":"Deprecated: no longer maintained. The GitHub repository has been archived and no further releases will be published."}},"time":{"created":"2014-08-04T23:07:31.848Z","modified":"2026-01-29T12:17:02.138Z","0.0.1":"2014-08-04T23:07:31.848Z","0.0.2":"2014-08-05T13:10:13.517Z","0.1.0":"2014-08-06T15:32:56.436Z","0.1.1":"2014-08-12T14:55:25.872Z","0.1.2":"2014-12-10T12:21:42.208Z","0.1.3":"2015-01-16T15:30:12.581Z","0.1.4":"2015-05-15T15:37:23.973Z","1.0.0":"2015-12-17T10:58:25.895Z","0.0.2-update-typed-error-cca6e4aa8015d5e2c1d73cca1072c497dcd4c377":"2018-11-06T15:59:34.663Z","1.0.1-update-typed-error-16bded9e6c79cd2dab0658e3898d8c7593a44499":"2018-11-06T16:50:24.692Z","1.0.1":"2018-11-06T17:07:04.725Z"},"bugs":{"url":"https://github.com/resin-io/bluebird-lru-cache/issues"},"homepage":"https://github.com/resin-io/bluebird-lru-cache#readme","repository":{"url":"git+https://github.com/resin-io/bluebird-lru-cache.git","type":"git"},"description":"<a href=\"http://promisesaplus.com/\">     <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" /> </a>","maintainers":[{"name":"balena.io","email":"accounts+npm@balena.io"},{"name":"page","email":"page@resin.io"}],"readme":"<a href=\"http://promisesaplus.com/\">\n    <img src=\"http://promisesaplus.com/assets/logo-small.png\" alt=\"Promises/A+ logo\" title=\"Promises/A+ 1.0 compliant\" align=\"right\" />\n</a>\n\nbluebird-lru-cache\n=========\n\nIn-memory, Promises/A+ [lru-cache](https://github.com/isaacs/node-lru-cache) via [bluebird](https://github.com/petkaantonov/bluebird), inspired by [bluecache](https://github.com/kurttheviking/bluecache)\n\n\n### Motivation\n\nAllow easy use of LRU-Cache within a promise architecture, both accepting and returning promises.\n\n\n### Usage\n\n```\nvar BluebirdLRU = require(\"bluebird-lru-cache\");\nvar options = {\n  max: 500,\n  maxAge: 1000 * 60 * 60\n};\n\nvar cache = BluebirdLRU(options);\n\ncache.set(\"key\", \"value\")\n.then(function () {\n\treturn cache.get(\"key\")\n})\n.then(function (value) {\n\tconsole.log(value);  // \"value\"\n});\n```\n\n\n### Options\n\nOptions are passed directly to LRU Cache at instantiation; the below documentation is based on the API descriptions of the underlying LRU Cache:\n\n- `max`: The maximum size of the cache, checked by applying the length function to all values in the cache\n- `maxAge`: Maximum age in ms; lazily enforced; expired keys will return `undefined`\n- `length`: Function called to calculate the length of stored items (e.g. `function(n) { return n.length; }`); defaults to `function(n) { return 1; }`\n- `dispose`: Function called on items immediately before they are dropped from the cache. Called with parameters (`key`, `value`)\n- `stale`: Allow the cache to return the stale (expired via `MaxAge`) value before deleting it\n- `noreject`: _bluebird-lru-cache only_; Boolean; instructs bluebird-lru-cache not to generate rejected promises and instead resolve to undefined for missing or expired output from `get` and `peek`;  defaults to `false`\n- `fetchFn`: _bluebird-lru-cache only_; Function; instructs bluebird-lru-cache to use this function to fetch and store data using this function if it does not already exist in the cache, instead of returning a rejection or `undefined`\n\n\n### API\n\nAny of the arguments for these functions can be a promise, which will be resolved before executing the method.\n\n**`set(key, value, max)`**\n\nSet the given `key` in the cache to `value`; updates the \"recently-used\"-ness of the key; returns a promise that resolves to a boolean indicating whether the value was stored or not (in the case of the value being too large it will not be stored).  \n`max` is optional and overrides the cache `max` option if provided.\n\n```\nvar promisedKey = Promise.resolved().delay(500).then(function () {\n\treturn 'foo';\n});\nvar promisedValue = Promise.resolved().delay(500).then(function () {\n\treturn 'bar';\n});\n\ncache.set(promisedKey, promisedValue).then(function (cached) {\n\tconsole.log(cached);  // => true\n});\n```\n\n\n**get(key)**\n\nReturns a promise that resolves to the cached value of `key`; updates the \"recently-used\"-ness of the key.\n\nIn the case of the key not existing, the Promise will be rejected with a `BluebirdLRU.NoSuchKeyError`, with a `key` property that resolves to the key that could not be found.\n\n\n**peek(key)**\n\nReturns a promise that resolves to the cached value of `key` _without_ updating the \"recently-used\"-ness of the key.\n\nIn the case of the key not existing, the Promise will be rejected with a `BluebirdLRU.NoSuchKeyError`, with a `key` property that resolves to the key that could not be found.\n\n\n**del(key)**\n\nReturns a promise that resolves to `undefined` after deleting the key from the cache.\n\n\n**reset()**\n\nReturns a promise that resolves to `undefined` after removing the key from the cache.\n\n\n**has(key)**\n\nReturns a promise that resolves to either `true` or `false` without updating the \"recently-used\"-ness; does not impact the use of `stale` data.\n\n\n**forEach(function(value,key,cache), [thisp])**\n\nJust like `Array.prototype.forEach`.  Iterates over all the keys in the cache, in order of recent-ness.  (Ie, more recently used items are iterated over first.)\n\n\n**keys()**\n\nReturns a promise that resolves to an array of the keys in the cache.\n\n```\ncache.keys().then(function (keys) {\n\tconsole.log(keys);\n});\n```\n\n**values()**\n\nReturns a promise that resolves to an array of the values in the cache.\n\n```\ncache.values().then(function (values) {\n\tconsole.log(values);\n});\n```\n\n**length()**\n\nReturn total length of objects in cache taking into account `length` options function.\n\n**itemCount()**\n\nReturn total quantity of objects currently in cache. Note, that `stale` (see options) items are returned as part of this item count.\n\n### Rejection handling\n\nBy default BluebirdLRU returns a rejected promise for get/peek operations that fail, as such:\n\n```\nvar BluebirdLRU = require('bluebird-lru-cache');\n\nvar cache = BluebirdLRU();\n\ncache.get('foo').catch(BluebirdLRU.NoSuchKeyError, function (err) {\n\tconsole.log('Could not find key:', err.key); // => \"Could not find key: foo\"\n});\n```\n\nyou can disable this with the `noreject` option:\n\n```\nvar BluebirdLRU = require('bluebird-lru-cache');\n\nvar cache = BluebirdLRU({\n  noreject: true\n});\n\ncache.get('foo').then(function (value) {\n\tif (value === undefined) {\n\t\tconsole.log('Could not find key'); // => \"Could not find key\"\n\t}\n});\n```\n\n### Contribute\n\nPRs are welcome! For bugs, please include a failing test which passes when your PR is applied.\n","readmeFilename":"README.md"}