{"_id":"async-cache","_rev":"312226","name":"async-cache","description":"Cache your async lookups and don't fetch the same thing more than necessary.","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"isaacs","email":""}],"time":{"modified":"2026-04-07T21:15:00.000Z","created":"2012-08-10T15:57:34.170Z","1.1.0":"2016-03-19T02:48:59.291Z","1.0.0":"2015-05-24T05:46:14.249Z","0.1.5":"2014-03-17T18:01:35.698Z","0.1.4":"2014-02-07T00:20:51.031Z","0.1.3":"2013-07-02T19:28:06.096Z","0.1.2":"2013-04-06T22:32:30.441Z","0.1.1":"2013-01-15T16:12:35.662Z","0.1.0":"2012-10-19T14:02:35.429Z","0.0.2":"2012-08-10T18:47:17.875Z","0.0.1":"2012-08-10T15:57:34.170Z"},"users":{"cybo42":true,"roboterhund87":true,"c1freitas":true,"kesla":true,"wenbing":true,"antixrist":true},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache.git"},"versions":{"1.1.0":{"name":"async-cache","version":"1.1.0","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"files":["ac.js"],"dependencies":{"lru-cache":"^4.0.0"},"devDependencies":{"standard":"^3.11.0","tap":"^2.0.0"},"scripts":{"test":"standard && tap test/*.js --cov"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache.git"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","gitHead":"d8a0e9a2cd0332e380e9459591f18402828f975a","bugs":{"url":"https://github.com/isaacs/async-cache/issues"},"homepage":"https://github.com/isaacs/async-cache#readme","_id":"async-cache@1.1.0","_shasum":"4a9a5a89d065ec5d8e5254bd9ee96ba76c532b5a","_from":".","_npmVersion":"3.7.3","_nodeVersion":"5.6.0","_npmUser":{"name":"isaacs","email":"i@izs.me"},"dist":{"shasum":"4a9a5a89d065ec5d8e5254bd9ee96ba76c532b5a","size":2759,"noattachment":false,"key":"/async-cache/-/async-cache-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-1.1.0.tgz"},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/async-cache-1.1.0.tgz_1458355738878_0.8185454660560936"},"publish_time":1458355739291,"_cnpm_publish_time":1458355739291,"_hasShrinkwrap":false,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"1.0.0":{"name":"async-cache","version":"1.0.0","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.3"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache.git"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","gitHead":"b3597a0f5f4f93fe58c5cc99c020db2c4256e6df","bugs":{"url":"https://github.com/isaacs/async-cache/issues"},"homepage":"https://github.com/isaacs/async-cache#readme","_id":"async-cache@1.0.0","_shasum":"c87f6d80c72b394ee0f9061edeb24d8c4b622ada","_from":".","_npmVersion":"2.10.1","_nodeVersion":"2.0.1","_npmUser":{"name":"isaacs","email":"isaacs@npmjs.com"},"dist":{"shasum":"c87f6d80c72b394ee0f9061edeb24d8c4b622ada","size":101352,"noattachment":false,"key":"/async-cache/-/async-cache-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-1.0.0.tgz"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1432446374249,"_cnpm_publish_time":1432446374249,"_hasShrinkwrap":false,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.1.5":{"name":"async-cache","version":"0.1.5","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.3"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/async-cache/issues"},"homepage":"https://github.com/isaacs/async-cache","_id":"async-cache@0.1.5","dist":{"shasum":"b7cd396d295aa8c52829bbe30ec33b62426006da","size":3550,"noattachment":false,"key":"/async-cache/-/async-cache-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.1.5.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1395079295698,"_hasShrinkwrap":false,"_cnpm_publish_time":1395079295698,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.1.4":{"name":"async-cache","version":"0.1.4","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.3"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"ISC","bugs":{"url":"https://github.com/isaacs/async-cache/issues"},"homepage":"https://github.com/isaacs/async-cache","_id":"async-cache@0.1.4","dist":{"shasum":"6dce989cffbd4b80fac86b3aeb7b37a25ef14e44","size":3539,"noattachment":false,"key":"/async-cache/-/async-cache-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.1.4.tgz"},"_from":".","_npmVersion":"1.3.26","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1391732451031,"_hasShrinkwrap":false,"_cnpm_publish_time":1391732451031,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.1.3":{"name":"async-cache","version":"0.1.3","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.3"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"BSD","bugs":{"url":"https://github.com/isaacs/async-cache/issues"},"_id":"async-cache@0.1.3","dist":{"shasum":"f8b6e68114e5b4766e34dd17d3a381ca7bd930ff","size":3028,"noattachment":false,"key":"/async-cache/-/async-cache-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.1.3.tgz"},"_from":".","_npmVersion":"1.3.1","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1372793286096,"_hasShrinkwrap":false,"_cnpm_publish_time":1372793286096,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.1.2":{"name":"async-cache","version":"0.1.2","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.3"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"BSD","_id":"async-cache@0.1.2","dist":{"shasum":"9183b6ac3834ee3ca28bfdfb2029f33be779fe31","size":2990,"noattachment":false,"key":"/async-cache/-/async-cache-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.1.2.tgz"},"_from":".","_npmVersion":"1.2.17","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1365287550441,"_hasShrinkwrap":false,"_cnpm_publish_time":1365287550441,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.1.1":{"name":"async-cache","version":"0.1.1","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.2"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"BSD","_id":"async-cache@0.1.1","dist":{"shasum":"09a6955a3be701dba03ad6fd7fc313e7dd80feb5","size":2654,"noattachment":false,"key":"/async-cache/-/async-cache-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.1.1.tgz"},"_from":".","_npmVersion":"1.2.1","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1358266355662,"_hasShrinkwrap":false,"_cnpm_publish_time":1358266355662,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.1.0":{"name":"async-cache","version":"0.1.0","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.1.0"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"BSD","_id":"async-cache@0.1.0","dist":{"shasum":"2f18aabae2c8f706b73e13cf5942f35606fb8218","size":2566,"noattachment":false,"key":"/async-cache/-/async-cache-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.1.0.tgz"},"_npmVersion":"1.1.63","_npmUser":{"name":"isaacs","email":"i@izs.me"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1350655355429,"_hasShrinkwrap":false,"_cnpm_publish_time":1350655355429,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.0.2":{"name":"async-cache","version":"0.0.2","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.0.0"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"BSD","_id":"async-cache@0.0.2","dist":{"shasum":"26d1566be36116e4605ed99aa926860515a0e9b8","size":2342,"noattachment":false,"key":"/async-cache/-/async-cache-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.0.2.tgz"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1344624437875,"_hasShrinkwrap":false,"_cnpm_publish_time":1344624437875,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."},"0.0.1":{"name":"async-cache","version":"0.0.1","description":"Cache your async lookups and don't fetch the same thing more than necessary.","main":"ac.js","directories":{"test":"test"},"dependencies":{"lru-cache":"~2.0.0"},"devDependencies":{"tap":"~0.3.0"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/isaacs/async-cache"},"keywords":["async","cache","lru"],"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"http://blog.izs.me/"},"license":"BSD","_id":"async-cache@0.0.1","dist":{"shasum":"995ed75b1146626125a3dd1efb486690ee61f6fe","size":2323,"noattachment":false,"key":"/async-cache/-/async-cache-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/async-cache/download/async-cache-0.0.1.tgz"},"maintainers":[{"name":"isaacs","email":""}],"publish_time":1344614254170,"_hasShrinkwrap":false,"_cnpm_publish_time":1344614254170,"deprecated":"No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option."}},"readme":"# async-cache\n\nCache your async lookups and don't fetch the same thing more than\nnecessary.\n\n## Example\n\nLet's say you have to look up stat info from paths.  But you are ok\nwith only looking up the stat info once every 10 minutes (since it\ndoesn't change that often), and you want to limit your cache size to\n1000 objects, and never have two stat calls for the same file\nhappening at the same time (since that's silly and unnecessary).\n\nYou can do this:\n\n```javascript\nvar stats = new AsyncCache({\n  // options passed directly to the internal lru cache\n  max: 1000,\n  maxAge: 1000 * 60 * 10,\n  // method to load a thing if it's not in the cache.\n  // key must be unique in the context of this cache.\n  load: function (key, cb) {\n    // the key can be something like the path, or fd+path, or whatever.\n    // something that will be unique.\n    // this method will only be called if it's not already in cache, and will\n    // cache the result in the lru.\n    getTheStatFromTheKey(key, cb)\n  }\n})\n\n// then later..\nstats.get(fd + ':' + path, function (er, stat) {\n  // maybe loaded from cache, maybe just fetched\n})\n```\n\nExcept for the `load` method, all the options are passed unmolested to\nthe internal [lru-cache](http://npm.im/lru-cache).\n\n### Differences from [lru-cache](http://npm.im/lru-cache)\n\nSince values are fetched asynchronously, the `get` method takes a\ncallback, rather than returning the value synchronously.\n\nWhile there is a `set(k,v)` method to manually seed the cache,\ntypically you'll just call `get` and let the load function fetch the\nkey for you.\n\nKeys must uniquely identify a single object, and must contain all the\ninformation required to fetch an object, and must be strings.\n\n### Per key `maxAge`\n\nIf `load` callback is called with 3 arguments, the 3rd is passed to\nthe internal [lru-cache](http://npm.im/lru-cache) as a `maxAge` for\nthe retrieved key.\n\n```javascript\n  function load (key, cb) {\n    getValueFromTheKey(key, function (err, item) {\n      cb(err, item.value, item.maxAge)\n    })\n  }\n```\n\n## Methods\n\n* `get(key, cb)` If the key is in the cache, then calls `cb(null,\n  cached)` on nextTick.  Otherwise, calls the `load` function that was\n  supplied in the options object.  If it doesn't return an error, then\n  cache the result.  Multiple `get` calls with the same key will only\n  ever have a single `load` call at the same time.\n\n* `set(key, val, maxAge)` Seed the cache.  This doesn't have to be done, but\n  can be convenient if you know that something will be fetched soon.\n  `maxAge` is optional - it is passed to internal LRU cache\n\n* `reset()` Drop all the items in the cache.\n","_attachments":{},"homepage":"https://github.com/isaacs/async-cache#readme","bugs":{"url":"https://github.com/isaacs/async-cache/issues"},"license":"ISC"}