Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use hget in ioredis?

Tags:

node.js

redis

I'm trying to use hget and hset in ioredis in my node script, I check the documentation, but can not find how to do it, Any idea how to do it?

Thanks,

like image 293
zedtrix Avatar asked Sep 22 '15 17:09

zedtrix


1 Answers

This has been answered in the comment, but for future search engine hits, here's a runnable example if you have installed ioredis with npm i ioredis.

ioredis version used: [email protected]

const ioredis = require('ioredis');
const redis = new ioredis();

redis.hset('foo_key','foo_subkey', 'foo_value');

redis.hget('foo_key', 'foo_subkey').then(function (value) {
  console.log(value);
});

redis.quit();
like image 195
Jonathan M. Hethey Avatar answered Oct 05 '22 22:10

Jonathan M. Hethey