Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
machinepack-redis
Advanced tools
Structured Node.js bindings for Redis.
$ npm install machinepack-redis --save --save-exact
For the latest usage documentation, version information, and test status of this module, see http://node-machine.org/machinepack-redis. The generated manpages for each machine contain a complete reference of all expected inputs, possible exit states, and example return values. If you need more help, or find a bug, jump into Gitter or leave a message in the project newsgroup.
To run this example
First, if your Redis server is not running yet, open a new terminal window and do:
redis-server
Next, copy the example code below to a new
.js
file somewhere in your project (e.g.examples/basic-usage.js
). Then run:npm install machinepack-redis --save --save-exact
Finally, run the example:
node examples/basic-usage.js
/**
* Module dependencies
*/
var Redis = require('machinepack-redis');
Redis.getConnection({
connectionString: 'redis://127.0.0.1:6379',
}).exec({
error: function (err){
console.error('UNEXPECTED ERROR:',err);
},
malformed: function (report){
console.error('MALFORMED CONNECTION STRING:',report.error);
},
failedToConnect: function (report) {
console.error('FAILED TO CONNECT:',report.error);
},
success: function (report){
console.log('CONNECTED!');
// Now you can use the connection however you like!
//
// To use the connection:
// `report.connection`
var redisClient = report.connection;
//
// See http://www.sitepoint.com/using-redis-node-js/ for more, but as a quick example:
redisClient.set('stuff', 'things', function(err, reply) {
// If "SET" failed...
if (err) {
// Handle failed "SET"
// ...
console.error('SET failed:',err);
// Always release the connection when finished:
Redis.releaseConnection({ connection: redisClient }).exec({
error: function (err){ console.error('UNEXPECTED ERROR:',err); },
success: function (report){ console.log('Connection released.'); }
});
return;
}
// Otherwise "SET" was successful.
// Do stuff
console.log('mmk set that.');
// ....
// Always release the connection when finished:
Redis.releaseConnection({ connection: redisClient }).exec({
error: function (err){ console.error('UNEXPECTED ERROR:',err); },
success: function (report){ console.log('Connection released.'); }
});
});//</client.set
}
});//</Redis.getConnection>
This is a machinepack, an NPM module which exposes a set of related Node.js machines according to the machinepack specification. Documentation pages for the machines contained in this module (as well as all other NPM-hosted machines for Node.js) are automatically generated and kept up-to-date on the public registry. Learn more at http://node-machine.org/implementing/FAQ.
MIT © 2015 contributors
1.0.0
FAQs
Structured Node.js bindings for Redis.
The npm package machinepack-redis receives a total of 21,850 weekly downloads. As such, machinepack-redis popularity was classified as popular.
We found that machinepack-redis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.