{"_id":"record-cache","_rev":"239131","name":"record-cache","description":"Cache optimised for record like things","dist-tags":{"latest":"1.2.0"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2023-03-24T16:52:27.000Z","created":"2018-01-26T22:38:54.521Z","1.2.0":"2022-02-18T14:46:06.958Z","1.1.1":"2021-05-21T12:15:46.987Z","1.1.0":"2018-05-19T21:46:19.513Z","1.0.2":"2018-04-23T12:04:02.168Z","1.0.1":"2018-02-12T12:31:14.638Z","1.0.0":"2018-01-26T23:21:44.646Z","0.0.0":"2018-01-26T22:38:54.521Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"versions":{"1.2.0":{"name":"record-cache","version":"1.2.0","description":"Cache optimised for record like things","main":"index.js","dependencies":{"b4a":"^1.3.1"},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"homepage":"https://github.com/mafintosh/record-cache","gitHead":"cbe0e52665b5286c6c37f1eb5c597cf7539cde45","_id":"record-cache@1.2.0","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"shasum":"e601bc4f164d58330cc00055e27aa4682291c882","size":3869,"noattachment":false,"key":"/record-cache/-/record-cache-1.2.0.tgz","tarball":"http://name.csiicloud.com:7001/record-cache/download/record-cache-1.2.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-cache_1.2.0_1645195566806_0.1211454610828191"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-18T14:46:10.309Z","publish_time":1645195566958,"_cnpm_publish_time":1645195566958},"1.1.1":{"name":"record-cache","version":"1.1.1","description":"Cache optimised for record like things","main":"index.js","dependencies":{},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"homepage":"https://github.com/mafintosh/record-cache","gitHead":"e109417c413c2044eca6b35d35fc1ea1958ad120","_id":"record-cache@1.1.1","_nodeVersion":"16.1.0","_npmVersion":"6.14.13","dist":{"shasum":"ba3088a489f50491a4af7b14d410822c394fb811","size":3881,"noattachment":false,"key":"/record-cache/-/record-cache-1.1.1.tgz","tarball":"http://name.csiicloud.com:7001/record-cache/download/record-cache-1.1.1.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-cache_1.1.1_1621599346836_0.373737528642484"},"_hasShrinkwrap":false,"publish_time":1621599346987,"_cnpm_publish_time":1621599346987,"_cnpmcore_publish_time":"2021-12-16T22:49:58.986Z"},"1.1.0":{"name":"record-cache","version":"1.1.0","description":"Cache optimised for record like things","main":"index.js","dependencies":{},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"homepage":"https://github.com/mafintosh/record-cache","gitHead":"6cdc05ea8ce59232fbe58297de9788153f80eceb","_id":"record-cache@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"10.1.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"f8a467a691a469584b26e88d36b18afdb3932037","size":3876,"noattachment":false,"key":"/record-cache/-/record-cache-1.1.0.tgz","tarball":"http://name.csiicloud.com:7001/record-cache/download/record-cache-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-cache_1.1.0_1526766378949_0.8423860888701915"},"_hasShrinkwrap":false,"publish_time":1526766379513,"_cnpm_publish_time":1526766379513,"_cnpmcore_publish_time":"2021-12-16T22:49:59.191Z"},"1.0.2":{"name":"record-cache","version":"1.0.2","description":"Cache optimised for record like things","main":"index.js","dependencies":{},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"homepage":"https://github.com/mafintosh/record-cache","gitHead":"05d0f6d2fb5a8e24d934b44ab37be34d997377a9","_id":"record-cache@1.0.2","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"41732bd214d189ea8b25f0f6e5933ecdfdcbe244","size":3774,"noattachment":false,"key":"/record-cache/-/record-cache-1.0.2.tgz","tarball":"http://name.csiicloud.com:7001/record-cache/download/record-cache-1.0.2.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-cache_1.0.2_1524485042061_0.34474977091835024"},"_hasShrinkwrap":false,"publish_time":1524485042168,"_cnpm_publish_time":1524485042168,"_cnpmcore_publish_time":"2021-12-16T22:49:59.383Z"},"1.0.1":{"name":"record-cache","version":"1.0.1","description":"Cache optimised for record like things","main":"index.js","dependencies":{},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"homepage":"https://github.com/mafintosh/record-cache","gitHead":"ae078fee9008bff2b077d3b96122cf803a276fb6","_id":"record-cache@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.5.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"71ab9010056a7bb11a4e1e6b5685c19c93ae8025","size":3738,"noattachment":false,"key":"/record-cache/-/record-cache-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/record-cache/download/record-cache-1.0.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-cache_1.0.1_1518438673969_0.24679399155359616"},"_hasShrinkwrap":false,"publish_time":1518438674638,"_cnpm_publish_time":1518438674638,"_cnpmcore_publish_time":"2021-12-16T22:49:59.604Z"},"1.0.0":{"name":"record-cache","version":"1.0.0","description":"Cache optimised for record like things","main":"index.js","dependencies":{},"devDependencies":{"standard":"^10.0.3","tape":"^4.8.0"},"scripts":{"test":"standard && tape test.js"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"homepage":"https://github.com/mafintosh/record-cache","gitHead":"28b08a355513d38acf7afe06f01a494c62bb541c","_id":"record-cache@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"5ade2430be23335f0aa406ff3a6913e04649fcea","size":3724,"noattachment":false,"key":"/record-cache/-/record-cache-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/record-cache/download/record-cache-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-cache-1.0.0.tgz_1517008903785_0.6847727131098509"},"directories":{},"publish_time":1517008904646,"_hasShrinkwrap":false,"_cnpm_publish_time":1517008904646,"_cnpmcore_publish_time":"2021-12-16T22:49:59.983Z"},"0.0.0":{"name":"record-cache","version":"0.0.0","description":"WIP - nothing to see here","main":"index.js","dependencies":{},"devDependencies":{"standard":"^10.0.3"},"scripts":{"test":"standard"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/record-cache.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"homepage":"https://github.com/mafintosh/record-cache","gitHead":"10a1c0cb3154ff29a6e25a743642d72f6a6ddc02","_id":"record-cache@0.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.4.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"1076fa662b3458d31086d5a502a605ce348f9656","size":2949,"noattachment":false,"key":"/record-cache/-/record-cache-0.0.0.tgz","tarball":"http://name.csiicloud.com:7001/record-cache/download/record-cache-0.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/record-cache-0.0.0.tgz_1517006333550_0.49688519444316626"},"directories":{},"publish_time":1517006334521,"_hasShrinkwrap":false,"_cnpm_publish_time":1517006334521,"_cnpmcore_publish_time":"2021-12-16T22:50:00.142Z"}},"readme":"# record-cache\n\nCache optimised for record like things like `host:port` or `domain.names`.\n\n```\nnpm install record-cache\n```\n\n[![build status](https://travis-ci.org/mafintosh/record-cache.svg?branch=master)](https://travis-ci.org/mafintosh/record-cache)\n\n## Usage\n\n``` js\nvar recordCache = require('record-cache')\n\nvar cache = recordCache({\n  maxSize: 1000 // store ~1000 values at max\n  maxAge: 1000 // gc values older than ~1000ms\n})\n\ncache.add('hello', '127.0.0.1')\ncache.add('hello', '127.0.1.1')\ncache.add('hello', '127.0.0.2')\n\nconsole.log(cache.get('hello', 2)) // prints two of the above\n\n// wait 2s\nsetTimeout(function () {\n  console.log(cache.get('hello', 2)) // prints []\n}, 2000)\n```\n\n## API\n\n#### `var cache = recordCache([options])`\n\nCreate a new record cache.\n\nOptions include:\n\n``` js\n{\n  maxSize: 1000, // approximate max size\n  maxAge: 1000, // approximate max age in ms\n  onStale: false // function called when evicting stale records\n}\n```\n\nIn the worst case the cache will be `2 * maxSize` large, and\nif `maxAge` is used old values are gc'ed every `0.66 * maxAge - 1.33 * maxAge` with an optional callback to the `onStale` function upon record eviction.\n\nThis is to greatly simplify the data structures and also gives us a pretty decent\nperf boost compared to other cache modules out there.\n\n#### `cache.add(recordName, value)`\n\nPush a new value to the record set. `value` should be serialisable.\n\n#### `cache.remove(recordName, value)`\n\nRemove a value from the record set. `value` should be a previously added value.\n\n#### `var list = cache.get(recordName, [maxCount])`\n\nGet a list of values from the record set. The list will be randomised.\nSpecify `maxCount` to only get this many values at max.\n\n#### `cache.size`\n\nGet the actual size of the cache.\n\n#### `cache.clear()`\n\nClear all values from the cache.\n\n#### `cache.destroy()`\n\nCompletely destroy the cache. Needed if you are using the `maxAge` option to\ncancel the gc timer.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/record-cache","bugs":{"url":"https://github.com/mafintosh/record-cache/issues"},"license":"MIT"}