-
-
Save nanha/1308185 to your computer and use it in GitHub Desktop.
redis usage in node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load redis client | |
var r = require('redis').createClient(); | |
// set data for key | |
r.set('key', data); | |
// add data to key (list) | |
r.lpush('key', data); | |
// trim list to specific length | |
r.ltrim('key', 0, 1000); | |
// get value for key | |
r.get('key', function(err, data) { }); | |
// increment value | |
r.incr('key', function (err, data) { }); | |
// get range of data from list | |
r.lrange('key', 0, 5, function(err, data) { }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment