/**
 * Created by yxsu on 10/1/16.
 */
var redis = require('redis');
var client = redis.createClient();

//insert sample user id and name
var multi = client.multi();

multi.hset("1155014412", 'tutorial_session', '4');
multi.hset("1155033514", 'tutorial_session', '4');
multi.hset("1155034273", 'tutorial_session', '4');
multi.hset("1155034883", 'tutorial_session', '4');
multi.hset("1155045905", 'tutorial_session', '4');
multi.hset("1155048371", 'tutorial_session', '4');
multi.hset("1155049971", 'tutorial_session', '4');
multi.hset("1155051293", 'tutorial_session', '4');
multi.hset("1155059798", 'tutorial_session', '4');
multi.hset("1155043348", 'tutorial_session', '3');
multi.hset("1155045169", 'tutorial_session', '3');
multi.hset("1155047047", 'tutorial_session', '3');
multi.hset("1155047088", 'tutorial_session', '3');
multi.hset("1155047488", 'tutorial_session', '3');
multi.hset("1155048086", 'tutorial_session', '3');
multi.hset("1155048273", 'tutorial_session', '3');
multi.hset("1155048519", 'tutorial_session', '3');
multi.hset("1155048741", 'tutorial_session', '3');
multi.hset("1155048934", 'tutorial_session', '3');
multi.hset("1155067926", 'tutorial_session', '3');
multi.hset("1155067927", 'tutorial_session', '3');
multi.hset("1155073363", 'tutorial_session', '3');
multi.hset("1155074568", 'tutorial_session', '3');

//exchange session 3 and session 4
multi.del("session3");
multi.del("session4");
//insert
multi.sadd("session4", "1155014412");
multi.sadd("session4", "1155033514");
multi.sadd("session4", "1155034273");
multi.sadd("session4", "1155034883");
multi.sadd("session4", "1155045905");
multi.sadd("session4", "1155048371");
multi.sadd("session4", "1155049971");
multi.sadd("session4", "1155051293");
multi.sadd("session4", "1155059798");
multi.sadd("session3", "1155043348");
multi.sadd("session3", "1155045169");
multi.sadd("session3", "1155047047");
multi.sadd("session3", "1155047088");
multi.sadd("session3", "1155047488");
multi.sadd("session3", "1155048086");
multi.sadd("session3", "1155048273");
multi.sadd("session3", "1155048519");
multi.sadd("session3", "1155048741");
multi.sadd("session3", "1155048934");
multi.sadd("session3", "1155067926");
multi.sadd("session3", "1155067927");
multi.sadd("session3", "1155073363");
multi.sadd("session3", "1155074568");

multi.exec(function(err, replies){
   console.log(replies.length + ' records are inserted.')
});
