青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

那誰的技術博客

感興趣領域:高性能服務器編程,存儲,算法,Linux內核
隨筆 - 210, 文章 - 0, 評論 - 1183, 引用 - 0
數據加載中……

The design and implementation of CommonCache Library(base on version 0.6)


1. Overview

a) the functions of a cache
cache the most frequently visited data in the memory, so:
1) if the the data get losed is not a big matter,it means that you should not store data
in cache only, offen, cache is between the DB server and application,hence reduce visiting DB times
 and speed up application.
2) since the memory is not quite big, so the eliminating algorithm such LRU must to be used.
3) must support key-value-like API such as find/erase/set and so forth.

b) ccache feature (version 0.6):
1) using mmap to cache data in file, so it can be used in multi-thead and multi-process application.
2) support unfix size key node
3) support hash-rbtree and hash-list structure
4) use LRU algorithm to eliminate nodes when it is running out of its memory size
5) fast, 100W/read operation on fix-size key node in no more than 0.5 second

c) what is the difference between ccache and memcached?
ccache is a static library, memcached is a cache sever, so users who use ccache must
design the protocols between clients and server, and write the server application themself.

2. implementation
a) the cache file structure


b) the hashitem array detail   
the hashitem array is used to find the node base on the node key.Every nodes in a
same hashitem has a same hash num.All the nodes in the same hashitem are strutured
in list or rbtree:


when compiling the ccache, define the macro CCACHE_USE_RBTREE to specily using rbtree,
else macro CCACHE_USE_LIST using list. The structrue ccache_node_t has following fields
about this:

typedef struct ccache_node_t
{
        
/* 
          
         
*/

#ifdef CCACHE_USE_LIST
    
struct ccache_node_t *next, *prev;
#elif defined CCACHE_USE_RBTREE    
    ccache_color_t color;
    
struct ccache_node_t *parent, *left, *right;
#endif

        
/* 
          
         
*/

}
ccache_node_t;

the hashitem array size is defined in the configure file when open the cache.

c) the freearea array detail   
ccache use slab-like algorithm to allocate node memory.In the configure file, there is an
item called "alignsize", this value specify the align size between different freearea,
assume the alignsize is 8 bytes:

all the nodes in the same freearea has the same size, when allocating a node(ccache_memory.c/ccache_allocate):
1) allign the node size with the alignsize value, then find the fit
freearea(ccache_memory.c/ccache_get_freeareaid) and return the freeareaid
2) if the data zone has enough memory for the node, change the cache->start_free and cache->freesize
and return the node pointer
3) else, erase the  cache->freearea[freeareaid]->lrulast node, use this node memory
for this allocation.
4) every time a node allocated, place it in the freearea's tail(freearea->lrulast = node),
when the node has been visited, it move on one step in the freearea list.So, the more a node has been
visited, the closer it moves to the freearea head(freearea->lrufirst).Hence, the freearea lrulast
node is the less frequently visited node in the freearea(although not so accurate:).

the ccache_node_t structure has following fields about LRU:

typedef struct ccache_node_t
{
    
/*
       .
    
*/
       
    
struct ccache_node_t *lrunext, *lruprev;

    
/*
       .
    
*/
       
}
ccache_node_t;

 

 

posted on 2009-10-22 21:11 那誰 閱讀(4122) 評論(1)  編輯 收藏 引用 所屬分類: ccache

評論

# re: The design and implementation of CommonCache Library(base on version 0.6)  回復  更多評論   

開源,大力支持??!
中國缺少這樣的東西
2010-03-10 19:37 | jesse
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            91久久久精品| 亚洲第一偷拍| 正在播放欧美视频| 亚洲精品视频啊美女在线直播| 欧美肥婆bbw| 亚洲一区二区少妇| 亚洲一二三四久久| 国内久久婷婷综合| 欧美激情视频网站| 欧美性猛交xxxx乱大交蜜桃| 亚洲综合色婷婷| 久久九九精品| 99精品国产高清一区二区| 亚洲一区二区三区视频| 国产综合色在线| 亚洲欧洲综合另类在线| 欧美日韩国产成人在线| 久久精品av麻豆的观看方式| 免费亚洲视频| 午夜亚洲性色福利视频| 久久夜色精品国产| 亚洲午夜精品视频| 欧美在线视频导航| 99re66热这里只有精品4| 亚洲伊人观看| 99在线视频精品| 欧美一级久久久| 中文一区字幕| 欧美成人亚洲成人| 欧美在线一区二区| 欧美精品一区二区三区在线播放 | 欧美一区2区三区4区公司二百| 在线日本欧美| 亚洲色图自拍| 99re视频这里只有精品| 欧美在线在线| 亚洲欧美经典视频| 欧美精品久久一区二区| 久久久久99| 国产精品日韩欧美一区二区| 亚洲国产成人av好男人在线观看| 国产日韩欧美在线视频观看| 亚洲激情图片小说视频| 樱花yy私人影院亚洲| 亚洲午夜av在线| 久久久国产视频91| 亚洲欧美日韩另类| 欧美va天堂va视频va在线| 久久嫩草精品久久久精品一| 国产精品视频免费在线观看| 91久久在线| 亚洲毛片视频| 欧美高清视频在线观看| 欧美freesex8一10精品| 狠狠爱综合网| 欧美中文在线字幕| 久久久精品日韩欧美| 国产色婷婷国产综合在线理论片a| 99热精品在线观看| 日韩视频久久| 欧美sm视频| 亚洲精品一级| 亚洲视频二区| 国产精品美女久久久免费| 中文有码久久| 欧美一区二区三区免费看| 国产精品久久国产精品99gif | 欧美在线关看| 久久免费精品视频| 亚洲国产精品久久久久秋霞蜜臀| 久久躁日日躁aaaaxxxx| 亚洲第一页自拍| 99re66热这里只有精品4| 欧美日韩成人一区二区| 一本一本a久久| 午夜精品www| 国产亚洲一区二区三区在线观看| 久久精品女人| 亚洲人体大胆视频| 亚洲在线观看视频网站| 国产精品尤物福利片在线观看| 亚洲欧美一区二区精品久久久| 久久色中文字幕| 亚洲欧洲偷拍精品| 欧美三级日本三级少妇99| 亚洲欧美成人网| 久久综合伊人77777蜜臀| 亚洲精品在线免费观看视频| 欧美日韩一区在线播放| 亚洲欧美日韩一区在线| 久久亚洲春色中文字幕久久久| 亚洲精品1234| 欧美亚州一区二区三区| 欧美资源在线| 亚洲美女在线视频| 老司机亚洲精品| 亚洲一二三区视频在线观看| 国产亚洲一级| 欧美日韩一区二区免费视频| 欧美亚洲综合另类| 91久久极品少妇xxxxⅹ软件| 欧美一区二区网站| 亚洲精品免费在线播放| 国产精品综合不卡av| 免费视频久久| 亚洲性人人天天夜夜摸| 国自产拍偷拍福利精品免费一| 欧美精品色一区二区三区| 欧美一区三区三区高中清蜜桃| 亚洲国产一区二区精品专区| 久久www成人_看片免费不卡| 亚洲久久一区| 激情成人av在线| 国产精品永久免费视频| 欧美日韩国产精品成人| 久久亚洲视频| 欧美一区二区视频在线| 一区二区高清视频| 91久久精品国产91性色tv| 久久久久成人网| 亚洲在线观看免费| aⅴ色国产欧美| 国产亚洲精品高潮| 国产精品欧美风情| 欧美三级电影大全| 欧美福利视频网站| 欧美综合国产| 亚洲欧美中文日韩在线| 一区二区三区日韩在线观看| 欧美激情一区二区三区四区| 另类尿喷潮videofree| 久久精品久久99精品久久| 欧美一区二区免费观在线| 午夜激情综合网| 亚洲欧美另类综合偷拍| 久久久国产精品一区二区中文 | 亚洲欧美综合| 亚洲一区二区三区视频播放| 亚洲精品视频在线| 91久久久久久| 亚洲三级电影全部在线观看高清| 欧美成人一二三| 欧美黄色一级视频| 亚洲激情二区| 亚洲精品视频中文字幕| 欧美激情综合色| 亚洲人成亚洲人成在线观看图片| 欧美国产亚洲精品久久久8v| 欧美国产乱视频| 欧美成人精品一区二区| 亚洲国产aⅴ天堂久久| 亚洲第一综合天堂另类专| 欧美不卡三区| 亚洲人成在线播放| 在线亚洲美日韩| 性色av一区二区三区| 久久成人一区| 欧美1区视频| 国产精品国产三级国产普通话99| 国产精品美女在线观看| 国内精品久久久久久久果冻传媒 | 亚洲精品黄色| 亚洲在线日韩| 久久精品视频亚洲| 欧美国产日韩一区| aa级大片欧美三级| 欧美一区二区在线| 欧美成人情趣视频| 国产精品www994| 黑丝一区二区三区| 99国产一区二区三精品乱码| 欧美亚洲免费高清在线观看| 美女日韩在线中文字幕| 亚洲精品一区二区三区在线观看| 亚洲男人影院| 欧美77777| 国产视频在线观看一区| 亚洲精品久久久久中文字幕欢迎你 | 欧美成人精品一区二区三区| 亚洲伦理中文字幕| 久久国产精品网站| 欧美日韩1区2区| 伊甸园精品99久久久久久| 中日韩男男gay无套| 久久午夜精品| 在线视频精品一| 久久香蕉精品| 国产精品综合色区在线观看| 亚洲精品视频在线观看网站| 午夜欧美大尺度福利影院在线看| 欧美大片国产精品| 欧美一二区视频| 欧美三区在线视频| 最近中文字幕mv在线一区二区三区四区 | 一区二区三区国产| 欧美激情在线播放| 久久精品人人做人人爽| 国产精品婷婷午夜在线观看| 99热在线精品观看| 亚洲高清不卡av|