1下載安裝后啟動(dòng)客戶端調(diào)試:
cd到安裝路徑
cd C:\Program Files\Redis
redis-cli.exe -h 127.0.0.1 -p 6379
密碼修改:修改配置文件“redis.windows-service.conf
################################## SECURITY ##################
# Require clients to issue AUTH <PASSWORD> before processing any other
# commands. This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
requirepass 密碼
修改新密碼需要重啟服務(wù),認(rèn)證密碼
C:\Program Files\Redis>redis-server --service-start
[15236] 17 Mar 08:40:19.111 # Redis service successfully started.
C:\Program Files\Redis>redis-cli.exe -h 127.0.0.1 -p 6379
127.0.0.1:6379> keys *
(error) NOAUTH Authentication required.
127.0.0.1:6379> auth food
OK -------------認(rèn)證成功
2查看所有key
3判斷 key的類型
4 string 類型數(shù)據(jù)
1) 設(shè)置值set 译秦,取值get
- 修改key的名字
3)刪除key
4) 查看key是否存在
5)設(shè)置key的過期時(shí)間,以秒計(jì)算 EXPIRE KEY Second
6)以秒為單位蛋叼,返回給定 key 的剩余生存時(shí)間(TTL, time to live)十兢。
PTTL key以毫秒為單位返回 key 的剩余的過期時(shí)間
5 LIST列表數(shù)據(jù)類型
6 哈希數(shù)據(jù)
6.1 HGETALL key 獲取在哈希表中指定 key 的所有字段和值
6.2 HSET key field value 將哈希表 key 中的字段 field 的值設(shè)為 value 。
6.3 設(shè)置哈希的過期時(shí)間
哈希 key 設(shè)置過期時(shí)間后,若哈希值由更改冷蚂,過期時(shí)間原先設(shè)置的剩余過期時(shí)間不變。若想改變過期時(shí)間汛闸,需要重新設(shè)置蝙茶。key過期后,Redis中將key自動(dòng)從Redis數(shù)據(jù)庫(kù)中刪除诸老。若想繼續(xù)使用隆夯,可以重新創(chuàng)建。