首页 > 其他 > 详细

redis笔记

时间:2014-01-24 12:11:42      阅读:376      评论:0      收藏:0      [点我收藏+]
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.
 
 
bubuko.com,布布扣
 
 
五种基本数据结构
 
1、Strings
bubuko.com,布布扣
bubuko.com,布布扣
 
 
2、Hashes
bubuko.com,布布扣
 
 
 
3、Lists
bubuko.com,布布扣
 
 
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.  
 
bubuko.com,布布扣
 
 
 
 
5、Sorted Sets
bubuko.com,布布扣
 
 
 
Big O Notation
              redis命令的速度
bubuko.com,布布扣
sismember居然是O(1)。猜测set是用哈希实现
 
 
 
 
当需求是不同的Key查同一个值时,可以利用Strings和Hashsets的结合
 
以下是不合理的做法
bubuko.com,布布扣
 
以下是比较好的做法
bubuko.com,布布扣
 
 
Monitor and Slow Log
    查看日志
bubuko.com,布布扣
 
 
 
 
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

 

 
 
 
 
bubuko.com,布布扣
 
 
 
 
bubuko.com,布布扣
 
 
bubuko.com,布布扣
 
 
bubuko.com,布布扣
 
 
 
 
参考:
 
 
 
 
 
 
 
 
 
 
 
 
 
   

redis笔记

原文:http://www.cnblogs.com/yemsheng/p/3531917.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!