redis sorted set source code analysis
来源:互联网 发布:dota2 数据bld 编辑:程序博客网 时间:2024/05/21 21:34
sorted set in t_zset.c file。
Insert operation:
zaddCommand -----> zaddGenericCommand
{ zzlFind
{ zzlDelete
{ zzlInsert
-------- { ziplist : http://blog.nosqlfan.com/html/3919.html
-------- { zzlGetScore
-------- { zzlInsertAt
--------------- { ziplistPush
--------------- { ziplistInsert
{ dictAdd
{ dictFind
{ dictGetKey
{ dictGetVal
{ zslInsert : zskiplist Insert
------------: http://www.cnblogs.com/xuqiang/archive/2011/05/22/2053516.html
{ zsetConvert : if the element is too large or the list becomes too long executing zzlInsert
-------------- { dictCreate
-------------- { zslCreate
#############################################################
args:
@ zs -> dict :
---------------: zs -----> zset struct
@ ele -> redisObject
@ &znode -> score
@ elements : add element number
@ redisObject : http://tech.it168.com/a2011/0818/1234/000001234478_all.shtml
@ zobj is redisObject
-------- zobj->encoding is the type of sort set key
#############################################################
#############################################################
Program process:
1. Parsing all the scores
2. lookup the key exist ?
---- if not exist
-------- if has not ziplist or ziplist value < len
------------creatzsetobject
-------- else createzsetziplistobject
-------- dbadd key
3. Insert the key
---- for to insert all element
---- if the node is less the max-ziplist-entries or node value less max-ziplist-value
-------- use ziplist struct
-------- else use skiplist
---- else if the key already encoding in REDIS_ENCODING_SKINGLIST
-------- insert the node in skiplist and dict
##############################################################
Summary:
1. the time complexity is log(n) because of skiplist
2. the time of dict is 0(1). use mapping like: key ----> score
- redis sorted set source code analysis
- caffe source code analysis
- UserGroupInformation Source Code Analysis
- Osip/eXosip Source Code Analysis
- hadoop wordcount source code analysis
- C/C++ Source Code Analysis
- CGAL join_face source code analysis
- CGAL collapse_edge source code analysis
- CGAL remove_face source code analysis
- CGAL join_vertex source code analysis
- redis sorted set index
- redis sorted set
- Source Code Analysis Using Java 6 APIs
- Eucalyptus Source Code Documentation and Analysis
- Golang Template source code analysis(Parse)
- SGI STL :: Source Code Analysis :: stl_config.h
- CEPH CRUSH algorithm source code analysis
- Tomcat 8 Source Code Analysis[1] Code Preparation
- 关于学生信息方面的sql统计练习
- linux 性能监控之----TOP
- 用maven整合struts+spring+hibernate之三 加入框架支持
- 加解密模块EncryptDecrypt.dll使用
- "在证书存储区中找不到清单签名证书"问题分析以及解决方案
- redis sorted set source code analysis
- linux 网络编程与 windows 网络编程
- 用maven整合struts+spring+hibernate之四 添加事务管理
- 糖果传递
- SVN服务器搭建和使用(三)
- DXGI的使用 --Direct2D 和 Direct3D 互操作性概述
- 网络实验(七动态路由协议配置)
- Boost智能指针:scoped_ptr shared_ptr weak_ptr
- python 3.3 复制文件 或 文件夹及其子文件夹 小例