redis笔记

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.
 
 
 
 
五种基本数据结构
 
1、Strings
 
 
2、Hashes
 
 
 
3、Lists
 
 
4、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.  
 
 
 
 
 
5、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

      Backups

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
参考:
 
 
 
 
 
 
 
 
 
 
 
 
 
   
原文地址:https://www.cnblogs.com/yemsheng/p/3531917.html