JQChan / node-practice

0 stars 0 forks source link

Node使用Redis #11

Open JQChan opened 3 years ago

JQChan commented 3 years ago

Node使用Redis

Redis安装

  1. Ubuntu安装
    sudo apt-get install redis-server redis-cli

    启动Redis服务器:

    service redis-server {start | stop | restart}

    打开客户算工具进行测试:

    redis-cli
    127.0.0.1:6379> PING
    PONG
  2. Mac安装
    brew install redis

    启动Redis服务器:

    
    // 启动Redis
    brew services start redis

// 重启Redis brew services restart redis

// 停止Redis brew services stop redis

打开客户算工具进行测试:

redis-cli PING

//成功返回PONG


## Redis命令
1. String(字符串)
```bash
redis-cli SET name "xialei"

redis-cli GET name

Node安装Redis

npm install redis