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
参考: