1、 Redis安装
下载地址:https://github.com/MSOpenTech/redis/releases
下载zip文件后直接解压
2、 启动Redis服务端
解压目录下执行redis-server.exe redis.windows.conf,启动服务
3、 命令行连接redis服务端
解压目录下执行redis-cli.exe -h 127.0.0.1 -p 6379
4、 Redis支持五种数据类型:string(字符串),hash(哈希),list(列表),set(集合)及zset(sorted set:有序集合)
(1) String
SET key value
GET key
(2)hash
HMSET key field value [filed value ...]
HGETALL key
(3) List
lpush key value [value ...]
lrange key start stop
(4) Set
sadd key member [member ...]
smembers key
(5) ZSet
zadd key [NX|XX] [CH] [INCR] score member [score member ...]
ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]
ZRANGE key start stop [WITHSCORES]
5、 密码管理
设置密码:CONFIG set requirepass "password"
查询密码:CONFIG get requirepass
密码验证:AUTH password
时间: 2024-11-11 14:54:03