1. 程式人生 > >SQL:redis快取資料庫深入

SQL:redis快取資料庫深入

簡介

REmote DIctionary Server(Redis) 是一個key-value快取資料庫

效能極高 – Redis能讀的速度是110000次/s,寫的速度是81000次/s

進入redis檔案目錄,執行cmd
啟動服務:redis-server.exe redis.windows.conf
連線執行:redis-cli.exe -h 127.0.0.1 -p 6379

配置檔案

// 檢視埠
127.0.0.1:6379> config get port
1) "port"
2) "6379"

//繫結的主機地址
127.0.0.1:6379> config get bind
1
) "bind" 2) "127.0.0.1" //本地資料庫檔名 127.0.0.1:6379> config get dbfilename 1) "dbfilename" 2) "dump.rdb" //本地資料庫存放目錄 127.0.0.1:6379> config get dir 1) "dir" 2) "D:\\Program Files\\Redis-x64-3.2.100" //檢視所有 127.0.0.1:6379> config get *

資料型別

String(字串) 一個鍵最大能儲存512MB
Hash(雜湊) 每個 hash 可以儲存 23**2 -1 鍵值對(40多億)
List(列表)最多可儲存 23**2 - 1 元素 (40多億)
Set(集合)集合中最大的成員數為 23**2 - 1(40多億)
zset(sorted set:有序集合)成員唯一,分數(score)可以重複,從小到大