{"_id":"simple-cache","_rev":"5-5beba67b5664ad33be3505ec0ce4adc3","name":"simple-cache","description":"Simple caching for Node. Like, really simple.","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"simple-cache","description":"Simple caching for Node. Like, really simple.","url":"http://github.com/hughsk/node-simple-cache","keywords":["simple","cache","storage","async"],"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"contributors":[],"dependencies":{},"main":"./simple-cache.js","version":"0.1.1","engines":{"node":">= 0.4.1"},"_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"_id":"simple-cache@0.1.1","devDependencies":{},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.2","_defaultsLoaded":true,"dist":{"shasum":"e17bc83ee1801271739a5f545a5835386f858420","tarball":"https://registry.npmjs.org/simple-cache/-/simple-cache-0.1.1.tgz","integrity":"sha512-7DCm9oHksWA8xcPrzrf85D1m4s5Oi9c0tQCCO0gk0lc2Z8KOZi8ojoQMQ/ZWVx5CIp3p7y4ppenb5f7tQ64NaQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8Hw8IRTVNzzKBRHJpl0IRQntMSGLOy5Tn4/d3ee8YOwIgPvTUUtLrxo3uZJznomx02DA1szJTwUXszNIBzOBgKak="}]},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}]}},"readme":"# node-simple-cache #\nSuper simple key/value storage for NodeJS. Wouldn't say it's production ready at all but if you're working on speeding up a small hack or prototype it's easy to use for caching and similar requirements.\n\n## Usage ##\nUnless you're getting a lot of concurrent requests, you can safely stick to using `Storage.get()` and `Storage.set()` to store and retrieve data.\n\n    var Storage = require('simple-cache').Storage;\n    var cache = new Storage();\n\n    if (!cache.exists('hello')) {\n    \tcache.set('hello', world);\n    }\n\n    cache.get('hello');\t\t\t//Returns 'world'\n\nBut when requests start to pile up, calling this within a non-blocking function such as `fs.readFile()` means that you could still be calling the function multiple times before it's stored in the cache. In this case, 'Storage.async()' keeps calls in line until the value is set.\n\n    var fs = require('fs');\n    var cache = new (require('simple-cache').Storage)();\n\n    //Incorrect\n    fs.readFile('filename', function(err, data) {\n    \tif (cache.exists('hello')) {\n    \t\tconsole.log(cache.get('hello'));\n    \t} else {\n    \t\tcache.set('hello', world);\n    \t\tconsole.log(cache.get('hello'));\n    \t}\n    });\n\n    //Correct\n    cache.async('hello', function(setValue) {\n    \tfs.readFile('filename', function(err, data) {\n    \t\tsetValue(data);\n    \t\tconsole.log(data);\n    \t});\n    }, function(value) {\n    \tconsole.log(value);\n    });","maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"time":{"modified":"2022-06-26T19:32:21.436Z","created":"2011-11-29T03:41:25.659Z","0.1.1":"2011-11-29T03:41:39.024Z"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com"}}