redis默认端口:6379

redis

https://www.npmjs.com/package/redis

  1. npm install redis

使用 redis
原生 redis怎么写,nodejs中 redis就怎么写

  1. const redis = require('redis');
  2. const client = redis.createClient(6379, 'localhost');
  3. client.set('name', 'longwen', redis.print);
  4. client.hset('user', 'name', 'longwen', redis.print);
  5. client.hgetall('user', (err ,keys) => {
  6. console.log(keys)
  7. }, redis.print);

vscode redis插件

image.png
image.png

image.png