zedtrix
zedtrix

Reputation: 53

Is it possible to use hget in ioredis?

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,

Upvotes: 5

Views: 5584

Answers (1)

Jonathan M. Hethey
Jonathan M. Hethey

Reputation: 714

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();

Upvotes: 6

Related Questions