users:leto "{name: leto, planet: dune, likers: [spice]}"
redis不能作查詢
我想查出planet都是dune的users都有哪些記錄。redid作不到
持久化
With respect to persistence, by default, Redis snapshots the database to disk based on how many keys have changed. You configure it so that if X number of keys change, then save the database every Y seconds. By default, Redis will save the database every 60 seconds if 1000 or more keys have changed all the way to 15 minutes if 9 or less keys has changed.
花費
Redis keeps all your data in memory. The obvious implication of this is the cost of running Redis: RAM is still the most expensive part of server hardware.
When you add those three things together you end up with something wonderful: speed. But that’s only part of it. The real reason Redis shines versus other solutions is its specialized data structures.
五種基本數據結構
一、Strings
二、Hashes
三、Lists
四、Sets
Sets are used to store unique values and provide a number of set-based operations, like unions. Sets aren’t ordered but they provide efficient value-based operations.
五、Sorted Sets
Big O Notation
redis命令的速度
sismember竟然是O(1)。猜想set是用哈希實現
當需求是
不一樣的Key查同一個值時,能夠利用Strings和Hashsets的結合
如下是不合理的作法
如下是比較好的作法
Monitor and Slow Log
查看日誌
Redis 2.6 includes a built-in Lua interpreter
Redis’ Lua implementation ships with a handful of useful libraries. While table.lib, string.lib and math.lib are quite useful, for me, cjson.lib is worth singling out.
配置
redis
.
conf
受權
Authentication
備份
Replication
參考: