简体   繁体   English

Redis Node.js获取过滤器

[英]Redis nodejs get filter

I'v faced the problem that nodeJS redis library dont have any way to get data by id that PHP library can. 我已经遇到了问题,nodeJS redis库没有任何方法可以通过PHP库可以通过id获取数据。

This is nodeJS code: 这是nodeJS代码:

var client = redis.createClient();
client.hgetall('auth', function (err, obj) {
    console.log(obj);
});

$this is php code that returns value by $auth_inner_key id $ this是通过$ auth_inner_key id返回值的php代码

$redis()->hGet('auth', $auth_inner_key);

The questions is - do nodejs redis have any way to get the same value or i need to look throught all of the auth results? 问题是-nodejs redis是否有办法获得相同的值,或者我需要查看所有的auth结果?

This is how you can get a particular value for a key from a hash set - nodejs 这是从哈希集中获取键的特定值的方法-Node.js

var client = redis.createClient();
  client.hget('auth',"auth_inner_key", function (err, obj) {
  console.log(obj);
});

how about client.get ? client.get怎么样?

var client = redis.createClient();
client.get('auth', function (err, value) {
    if(err) throw err;
    console.log(value);
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM