{"_id":"cache-http","_rev":"237-88b811544c56e34cf7708900bf55d49a","name":"cache-http","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"cache-http","version":"1.0.0","author":{"name":"Thomas Wilkinson","email":"thomas@capnajax.com"},"license":"MIT","_id":"cache-http@1.0.0","maintainers":[{"name":"strongloop","email":"callback@strongloop.com"}],"contributors":[{"name":"Thomas Wilkinson","email":"thomas@capnajax.com"}],"homepage":"http://github.com/strongloop/cache-http","bugs":{"url":"https://github.com/strongloop/cache-http/issues"},"dist":{"shasum":"2bee10a3d1f980498b33a23914eda1f416368bc2","tarball":"https://registry.npmjs.org/cache-http/-/cache-http-1.0.0.tgz","integrity":"sha512-4BVrt5rKSbaprRiL4+WczADgJNTnoEj372F2C11tGij68oK503WXVAf2cUzl3xCogtxIPbD3uW2rARNqkFJKuQ==","signatures":[{"sig":"MEQCIHOAeRbvSGwj/1NOAjQZ4ym/Zse18qIfJHctwcFU9KhBAiBMZ5Ru0MqaUxr2q65o/jfVAgv9T7/9qHcEcHn1bz8FvQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./protocols.js","_from":".","engine":{"node":">=0.4.0"},"_shasum":"2bee10a3d1f980498b33a23914eda1f416368bc2","gitHead":"2b20dc8d4e7d63c09acb967ca1e562ad455de45d","scripts":{"test":"mocha --timeout=10000"},"_npmUser":{"name":"strongloop","email":"callback@strongloop.com"},"repository":{"url":"https://github.com/strongloop/cache-http.git","type":"git"},"_npmVersion":"1.4.28","description":"Caching wrapper for node's http module","directories":{"test":"test"},"dependencies":{"lodash":"^3.9.1","node-cache":"^3.0.0"},"devDependencies":{"async":"^1.0.0","mocha":"^2.2.5"}},"1.0.1":{"name":"cache-http","version":"1.0.1","author":{"name":"Thomas Wilkinson","email":"thomas@capnajax.com"},"license":"MIT","_id":"cache-http@1.0.1","maintainers":[{"name":"bajtos","email":"mbajtoss@gmail.com"},{"name":"chandadharap","email":"chanda_dharap@yahoo.com"},{"name":"ibmcloud-admin","email":"rmg@ca.ibm.com"},{"name":"kraman","email":"kraman@gmail.com"},{"name":"octet","email":"vieuxtech@gmail.com"},{"name":"rfeng","email":"enjoyjava@gmail.com"},{"name":"ritch","email":"skawful@gmail.com"},{"name":"rmg","email":"r.m.graham@gmail.com"},{"name":"strongloop","email":"strngops@us.ibm.com"}],"contributors":[{"name":"Thomas Wilkinson","email":"thomas@capnajax.com"}],"homepage":"http://github.com/strongloop/cache-http","bugs":{"url":"https://github.com/strongloop/cache-http/issues"},"dist":{"shasum":"0a6f79eca2e24df946fe18523cace460ce336a6e","tarball":"https://registry.npmjs.org/cache-http/-/cache-http-1.0.1.tgz","integrity":"sha512-HTbFfcJ4HJDotthlVao2+GbnPRKwqOJTM7J0do1HSVEsnli0uRDe3UGyg33pwCPc15MDHMZSZ5leZVs4yl07kw==","signatures":[{"sig":"MEUCIHWN44f38x8/w4IOljqKckMhiip6wkM7Xtaeb7NL9e/wAiEA7uBq9A90txFFGheXFatSSUvsAzi6jgrWUhXzY3blQuk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./protocols.js","_from":".","engine":{"node":">=0.4.0"},"_shasum":"0a6f79eca2e24df946fe18523cace460ce336a6e","gitHead":"adca833f01e4766918d53d18cd636ae1458fe67f","scripts":{"test":"mocha --timeout=10000"},"_npmUser":{"name":"rmg","email":"r.m.graham@gmail.com"},"repository":{"url":"git+https://github.com/strongloop/cache-http.git","type":"git"},"_npmVersion":"3.8.8","description":"Caching wrapper for node's http module","directories":{"test":"test"},"_nodeVersion":"4.4.3","dependencies":{"lodash":"^3.9.1","node-cache":"^3.0.0"},"devDependencies":{"async":"^1.0.0","mocha":"^2.2.5"},"_npmOperationalInternal":{"tmp":"tmp/cache-http-1.0.1.tgz_1462576141780_0.021881790831685066","host":"packages-16-east.internal.npmjs.com"}}},"time":{"created":"2015-07-23T01:15:35.255Z","modified":"2026-04-14T15:10:10.341Z","1.0.0":"2015-07-23T01:15:35.255Z","1.0.1":"2016-05-06T23:09:04.727Z"},"bugs":{"url":"https://github.com/strongloop/cache-http/issues"},"author":{"name":"Thomas Wilkinson","email":"thomas@capnajax.com"},"license":"MIT","homepage":"http://github.com/strongloop/cache-http","repository":{"url":"git+https://github.com/strongloop/cache-http.git","type":"git"},"description":"Caching wrapper for node's http module","contributors":[{"name":"Thomas Wilkinson","email":"thomas@capnajax.com"}],"maintainers":[],"readme":"# Cached HTTP Client for Node.JS\n\nA Node.JS that adds a transparent cacheing layer to http and https clients.\n\n## Installation\n\n    $ npm install --save cache-http\n\n## Documentation\n\nThis is a drop-in replacement for Node's http(s) client. Very little code will\nneed to change to support cacheing.\n\n```javascript\nvar cachedHttp = new require('cache-http')('http');\nvar options = {\n  host: <hostname>,\n  port: <port>,\n  path: <path>,\n  method: 'GET',\n  'x-cacheable': true,\n};\ncachedHttp.request(options, callback).end();\n```\n\n The first line, the `require` returns a constructor that takes one parameter:\nthe protocol it is wrapping. Only `http` and `https` are supported.\n\nOnly the http(s) `GET` method is supported. Other methods don't really make much\nsense to cache.\n\nIn order to activate cacheing for any particular request, the `\"x-cacheable\"`\noption must be specified. Otherwise, this module will bypass the cacheing\nfeature. The cache keys are built from authorization key, method, host, port,\nand path(including parameters). If this is not sufficient to guarantee\nuniqueness it is best to disable cacheing for that request.\n\nIf there is cached data for a request, this cache will always check for new data\nusing the `If-Modified-Since` header. If the server reports an HTTP `304`, it'll\nreturn cached data. If the data came from cache, it'll have the `x-cached`\nresponse header.\n\n## Testing\n\nThe test script is comprehensive. It includes an HTTP server to test against\n(`test-bench`), test cases against this test bench, plus many tests against the\n`cached-http` as well. These test cases require Mocha to run.\n\n    $ cd test $ mocha all.js\n\nNote that some test cases take some time to run and will therefore generate\nwarnings, but they will ultimately pass. Test cases that are meant to take some\nare clearly marked with the approximate time they are expected to take.\n","readmeFilename":"README.md"}