jschan - Anonymous imageboard software. Classic look, modern features and feel. Works without JavaScript and supports Tor, I2P, Lokinet, etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
642 B

'use strict';
const Redis = require('ioredis')
, configs = require(__dirname+'/configs/main.json')
, client = new Redis(configs.redis);
module.exports = {
redisClient: client,
//get a value with key
get: (key) => {
return client.get(key).then(res => { return JSON.parse(res) });
},
//set a value on key
set: (key, value) => {
return client.set(key, JSON.stringify(value));
},
//add items to a set
sadd: (key, value) => {
return client.sadd(key, value);
},
//get random item from set
srand: (key) => {
return client.srandmember(key);
},
//delete value with key
del: (key) => {
return client.del(key);
},
}