machinepack-redis
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "machinepack-redis", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Structured Node.js bindings for Redis.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -45,2 +45,3 @@ | ||
```javascript | ||
@@ -53,19 +54,17 @@ /** | ||
Redis.getConnection({ | ||
Redis.createManager({ | ||
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){ | ||
onUnexpectedFailure: function (err){ console.warn('WARNING: unexpected failure. Details:',err); } | ||
}).exec(function (err, report) { | ||
if (err) { console.error('UNEXPECTED ERROR:',err); return; } | ||
var mgr = report.manager; | ||
Pack.getConnection({ | ||
manager: mgr | ||
}).exec(function (err, report) { | ||
if (err) { console.error('UNEXPECTED ERROR:',err); return; } | ||
console.log('CONNECTED!'); | ||
// Now you can use the connection however you like! | ||
// Now you can use the redis client however you like! | ||
// | ||
@@ -98,10 +97,17 @@ // To use the connection: | ||
// 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> | ||
// Release the connection when finished: | ||
// (note that you can skip this step and just destroy the manager if you wish) | ||
Redis.releaseConnection({ connection: redisClient }).exec(function(err) { | ||
if (err) { console.error('UNEXPECTED ERROR:',err); return; } | ||
console.log('Connection released.'); | ||
// But ALWAYS destroy the connection manager when finished | ||
Redis.destroyManager({ manager: mgr }).exec(function(err) { | ||
if (err) { console.error('UNEXPECTED ERROR:',err); return; } | ||
console.log('Done. (Manager destroyed)'); | ||
});//</Redis.destroyManager> | ||
});//</Redis.releaseConnection> | ||
});//</client.set> | ||
});//</Redis.getConnection> | ||
});//</Redis.createManager> | ||
``` | ||
@@ -108,0 +114,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26567
126