{"_id":"native-dns-cache","_rev":"324985","name":"native-dns-cache","description":"DNS Caching Library","dist-tags":{"latest":"0.0.2"},"maintainers":[{"name":"tjfontaine","email":""}],"time":{"modified":"2021-06-04T02:14:57.000Z","created":"2013-03-24T03:31:08.140Z","0.0.2":"2013-03-25T00:15:05.518Z","0.0.1":"2013-03-24T03:31:08.140Z"},"users":{},"author":{"name":"Timothy J Fontaine","email":"tjfontaine@gmail.com","url":"http://atxconsulting.com"},"repository":{"type":"git","url":"http://github.com/tjfontaine/native-dns-cache.git"},"versions":{"0.0.2":{"name":"native-dns-cache","version":"0.0.2","author":{"name":"Timothy J Fontaine","email":"tjfontaine@gmail.com","url":"http://atxconsulting.com"},"description":"DNS Caching Library","keywords":["dns","caching"],"homepage":"http://github.com/tjfontaine/native-dns-cache","bugs":{"url":"http://github.com/tjfontaine/native-dns-cache/issues"},"repository":{"type":"git","url":"http://github.com/tjfontaine/native-dns-cache.git"},"main":"index.js","engines":{"node":">= 0.5.0"},"scripts":{},"dependencies":{"binaryheap":">= 0.0.3","native-dns-packet":">= 0.0.1"},"devDependencies":{},"readmeFilename":"README.md","_id":"native-dns-cache@0.0.2","dist":{"shasum":"ce0998f7fdf6c7990970a33190624b0e98ee959b","size":4073,"noattachment":false,"key":"/native-dns-cache/-/native-dns-cache-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/native-dns-cache/download/native-dns-cache-0.0.2.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"tjfontaine","email":"tjfontaine@gmail.com"},"maintainers":[{"name":"tjfontaine","email":""}],"directories":{},"publish_time":1364170505518,"_cnpm_publish_time":1364170505518,"_hasShrinkwrap":false},"0.0.1":{"name":"native-dns-cache","version":"0.0.1","author":{"name":"Timothy J Fontaine","email":"tjfontaine@gmail.com","url":"http://atxconsulting.com"},"description":"DNS Caching Library","keywords":["dns","caching"],"homepage":"http://github.com/tjfontaine/native-dns-cache","bugs":{"url":"http://github.com/tjfontaine/native-dns-cache/issues"},"repository":{"type":"git","url":"http://github.com/tjfontaine/native-dns-cache.git"},"main":"index.js","engines":{"node":">= 0.5.0"},"scripts":{},"dependencies":{"binaryheap":">= 0.0.2","native-dns-packet":">= 0.0.1"},"devDependencies":{},"readmeFilename":"README.md","_id":"native-dns-cache@0.0.1","dist":{"shasum":"bbe9c23bc6d9c92cf4436e20493b91a3f59bd742","size":4074,"noattachment":false,"key":"/native-dns-cache/-/native-dns-cache-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/native-dns-cache/download/native-dns-cache-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"tjfontaine","email":"tjfontaine@gmail.com"},"maintainers":[{"name":"tjfontaine","email":""}],"directories":{},"publish_time":1364095868140,"_cnpm_publish_time":1364095868140,"_hasShrinkwrap":false}},"readme":"Cache\n-----\n\nIf you perform a query on an A or AAAA type and it doesn't exist, the cache\nwill attempt to lookup a CNAME and then resolve that.\n\nThe constructor takes an optional object with the following properties:\n\n * `store` -- implements the cache store model (optional, default MemoryStore)\n\nMethods:\n\n * `lookup(question, cb)` -- for a given question check the cache store for\nexistence\n * `store(packet)` -- iterates over the resource records in a packet and sends\nthem to the cache store\n * `purge()` -- clears the cache store of all entries\n\nMemoryStore / Cache store model\n-------------------------------\n\n`MemoryStore(opts)` -- An in memory store based on a js object\n\nMethods:\n\n * `get(domain, key, cb)`\n  - `domain` is the holder under which keys will be applied,\n`key` is the subdomain that is being queried for.\nIf you `get('example.com', 'www', cb)` you are really asking for `www.example.com`.\n  - `cb(err, results)` -- results is an object of types and array of answers\n   * `{ 1: [{address: '127.0.0.1', ttl: 300, type: 1, class: 1}] }`\n * `set(domain, key, data, cb)`\n  - `domain` is the parent under which this key is stored.\n`key` is the subdomain we are storing, `data` is an object of types with an array of answers.\n   * `set('example.com', 'www', {1: [{class:1, type:1, ttl:300, address:'127.0.0.1'}]}, cb)`\n  - `cb(err, data)` -- cb merely returns the data that was passed.\n * `delete(domain[, key[, type]], cb)` -- delete all from a domain, a domain and key,\nor a domain a key and a type.\n\nLookup\n------\n\nIs a mechanism that given a store performs the common resolution pattern.\n\nGiven `example.com` previous added to a store:\n\n  * `www.example.com CNAME foo.bar.example.com.`\n  * `*.example.com A 127.0.0.1`\n\nA `Lookup(store, 'example.com', {name:'www.example.com', type:1}, cb)`\nwill resolve `www` to the CNAME and then search for `foo.bar.example.com` which\nwill return no results, and then search for `*.bar.example.com` which will also\nreturn no results, and ultimately searches for `*.example.com` which will return\nthe desired record.\n\nCallback will be called with `(err, results)` where results is an array suitable\nfor use in `Packet.answer`\n","_attachments":{},"readmeFilename":"README.md","homepage":"http://github.com/tjfontaine/native-dns-cache","bugs":{"url":"http://github.com/tjfontaine/native-dns-cache/issues"}}