function updatehCache(id, key, value) { return new Promise((resv, rej) => { client.hset(id, key, value, (err, res) => { resv(1); }) }) }
coinList.forEach(function(coinItem){ if (ObjectUtils.isNonEmptyObject(coinItem)) { arrayLog.push(coinItem.symbol); arrayLog.push(coinItem); client.hset("coins", coinItem.symbol, JSON.stringify(coinItem), function (err, response) { if (err) { logger.log({"level": "error", "message": JSON.stringify(err)}); } }); } });
static async set(url, hash) { return await client.hset( queue, hash, url ); }
describe('Deleting Cities', function() { // add a city to be deleted. before(function() { client.hset('cities', 'Bananaville', 'A Town Created from Grafting.'); }); it('Returns 204 Status Code', function(done) { request(app) .delete('/cities/Bananaville') .expect(204, done); }); // remove any data created for this test after(function() { client.flushdb(); }); });
sub.on('message', (channel, message) => { redisClient.hset('values', message, fib(parseInt(message))) })
this.client.hset( 'presence', connectionId, JSON.stringify({ meta: meta, when: Date.now() }), function(err) { if (err) { console.error('Failed to store presence in redis: ' + err); } } );
function runRedis() { const rClient = redis.createClient(redisUrl); rClient.set('hello', 'world'); // nested hashes rClient.hset('spanish', 'red', 'rojo'); rClient.hset('spanish', 'orange', 'naranja'); rClient.hset('spanish', 'blue', 'azul'); rClient.hset('german', 'red', 'rot'); rClient.hset('german', 'orange', 'orange'); rClient.hset('german', 'blue', 'blau'); rClient.get('hello', (err, value) => { if (err) console.log(err); else console.log(value); }); rClient.hget('spanish', 'red', (err, value) => { if (err) console.log(err); else console.log(value); }); }
client.hset('cities', newCity.name, newCity.description, function(err) { if (err) { throw err;
hset (field, key, value) { return new Promise((resolve, reject) => { client.hset(field, key, value, error => { if (error) { reject(error) console.log(`[Redis hset error] ${error}`.red) } else { resolve() } }) }) }
describe('Shows a City Resource\'s Info', function() { before(function() { client.hset('cities', 'Derpltuckia', 'A City Filled with Hurp.'); }); it('Returns 200 Status Code', function(done) { request(app) .get('/cities/Derpltuckia') .expect(200, done); }); // a simple test to show templates are returning HTML it('Returns HTML Format', function(done) { request(app) .get('/cities/Derpltuckia') .expect('Content-Type', /html/, done); }); it('Returns City Metadata', function(done) { request(app) .get('/cities/Derpltuckia') .expect(/Hurp/, done); }); after(function() { client.flushdb(); }); });
sub.on('message', (channel, message) => { redisClient.hset('values', message, fib(parseInt(message))); });