通过brew安装redis,命令如下:
brew install redis
安装完成后,启动方法:
To have launchd start redis now and restart at login:
brew services start redis
Or, if you don't want/need a background service you can just run:
redis-server /usr/local/etc/redis.conf
上面的命令介绍可以看出:
- 后台运行:
brew services start redis
- 当前窗口运行:
redis-server /usr/local/etc/redis.conf
新启动一个窗口,命令端连接redis:
➜ ~ redis-cli
127.0.0.1:6379>
简单的设置一个值:
127.0.0.1:6379> set 'hehe' 1
OK
简单的获取一个值:
127.0.0.1:6379> get hehe
"1"
redis是一个强大的缓存服务器,支持多种数据类型,待学习。
网友评论