101 lines
4.6 KiB
JSON
101 lines
4.6 KiB
JSON
{
|
|
"_args": [
|
|
[
|
|
{
|
|
"raw": "lru-memoizer@^1.11.1",
|
|
"scope": null,
|
|
"escapedName": "lru-memoizer",
|
|
"name": "lru-memoizer",
|
|
"rawSpec": "^1.11.1",
|
|
"spec": ">=1.11.1 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/auth0"
|
|
]
|
|
],
|
|
"_from": "lru-memoizer@>=1.11.1 <2.0.0",
|
|
"_id": "lru-memoizer@1.11.1",
|
|
"_inCache": true,
|
|
"_location": "/lru-memoizer",
|
|
"_nodeVersion": "4.4.3",
|
|
"_npmOperationalInternal": {
|
|
"host": "packages-12-west.internal.npmjs.com",
|
|
"tmp": "tmp/lru-memoizer-1.11.1.tgz_1494524688891_0.7909194738604128"
|
|
},
|
|
"_npmUser": {
|
|
"name": "jfromaniello",
|
|
"email": "jfromaniello@gmail.com"
|
|
},
|
|
"_npmVersion": "4.2.0",
|
|
"_phantomChildren": {
|
|
"pseudomap": "1.0.2",
|
|
"yallist": "2.1.2"
|
|
},
|
|
"_requested": {
|
|
"raw": "lru-memoizer@^1.11.1",
|
|
"scope": null,
|
|
"escapedName": "lru-memoizer",
|
|
"name": "lru-memoizer",
|
|
"rawSpec": "^1.11.1",
|
|
"spec": ">=1.11.1 <2.0.0",
|
|
"type": "range"
|
|
},
|
|
"_requiredBy": [
|
|
"/auth0"
|
|
],
|
|
"_resolved": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-1.11.1.tgz",
|
|
"_shasum": "0693f6100593914c02e192bf9b8d93884cbf50d3",
|
|
"_shrinkwrap": null,
|
|
"_spec": "lru-memoizer@^1.11.1",
|
|
"_where": "/Volumes/2009-SSD/GT2/GT2-iOS/node_modules/auth0",
|
|
"author": {
|
|
"name": "José F. Romaniello",
|
|
"email": "jfromaniello@gmail.com",
|
|
"url": "http://joseoncode.com"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/jfromaniello/lru-memoizer/issues"
|
|
},
|
|
"dependencies": {
|
|
"lock": "~0.1.2",
|
|
"lodash": "~4.5.1",
|
|
"lru-cache": "~4.0.0",
|
|
"very-fast-args": "^1.1.0"
|
|
},
|
|
"description": "Memoize functions results using an lru-cache.",
|
|
"devDependencies": {
|
|
"chai": "^3.5.0",
|
|
"mocha": "~2.2.5"
|
|
},
|
|
"directories": {},
|
|
"dist": {
|
|
"shasum": "0693f6100593914c02e192bf9b8d93884cbf50d3",
|
|
"tarball": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-1.11.1.tgz"
|
|
},
|
|
"gitHead": "b068d9a85aa52501fa3f18aca1458f11eb483203",
|
|
"homepage": "https://github.com/jfromaniello/lru-memoizer#readme",
|
|
"keywords": [
|
|
"cache",
|
|
"memoize",
|
|
"lru"
|
|
],
|
|
"main": "index.js",
|
|
"maintainers": [
|
|
{
|
|
"name": "jfromaniello",
|
|
"email": "jfromaniello@gmail.com"
|
|
}
|
|
],
|
|
"name": "lru-memoizer",
|
|
"optionalDependencies": {},
|
|
"readme": "Memoize functions results using an lru-cache.\n\n## Installation\n\n```\nnpm i lru-memoizer --save\n```\n\n## Intro\n\nThis module uses an [lru-cache](https://github.com/isaacs/node-lru-cache) internally to cache the results of an async function.\n\nThe `load` function can have N parameters and the last one must be a callback. The callback should be an errback (first parameter is `err`).\n\nThe `hash` function purpose is generate a custom hash for storing results. It has all the arguments applied to it minus the callback, and must return an string synchronous.\n\nThe `freeze` option (defaults to **false**) allows you to deep-freeze the result of the async function.\n\nThe `clone` option (defaults to **false**) allows you to deep-clone the result every time is returned from the cache.\n\n## Usage\n\n```javascript\n\nvar memoizer = require('lru-memoizer');\n\nvar memoizedGet = memoizer({\n //defines how to load the resource when\n //it is not in the cache.\n load: function (options, callback) {\n request.get(options, callback);\n },\n\n //defines how to create a cache key from the params.\n hash: function (options) {\n return options.url + qs.stringify(options.qs);\n },\n\n //all other params for the LRU cache.\n max: 100,\n maxAge: 1000 * 60\n});\n\nmemoizedGet({\n url: 'https://google.com',\n qs: { foo: 123 }\n}, function (err, result, body) {\n //console.log(body);\n})\n\n```\n\n## Sync lru-memoizer\n\nUse `memoizer.sync` to cache things that are slow to calculate or methods returning promises.\n\n```\nvar memoizer = require('lru-memoizer');\nvar memoizedGet = memoizer.sync({\n //defines how to load the resource when\n //it is not in the cache.\n load: function (params) {\n //return something_hard_to_compute;s\n },\n\n //defines how to create a cache key from the params.\n hash: function (params) {\n return params.foo;\n },\n\n //all other params for the LRU cache.\n max: 100,\n maxAge: 1000 * 60\n});\n```\n\n## Similar modules\n\nThis module is very similar to [async-cache](https://github.com/isaacs/async-cache), the main difference is the `hash` function.\n\n## License\n\nMIT 2016 - José F. Romaniello\n",
|
|
"readmeFilename": "README.md",
|
|
"repository": {
|
|
"url": "git://github.com/jfromaniello/lru-memoizer.git"
|
|
},
|
|
"scripts": {
|
|
"test": "mocha"
|
|
},
|
|
"version": "1.11.1"
|
|
}
|