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

那誰的技術博客

感興趣領域:高性能服務器編程,存儲,算法,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久久一区二区| 欧美成人蜜桃| 亚洲一区影音先锋| 午夜精品在线看| 在线不卡视频| 亚洲精选视频免费看| 国产精品看片资源| 久久久久久久久久看片| 久久综合九色九九| 在线亚洲欧美专区二区| 一区二区三区视频在线| 国产一区二区精品| 亚洲国产精品精华液2区45| 欧美亚州一区二区三区 | 欧美日韩中文在线观看| 老司机午夜精品| 亚洲视频二区| 久久看片网站| 亚洲在线一区| 另类亚洲自拍| 羞羞答答国产精品www一本| 久久一区二区三区av| 亚洲一区二区视频在线| 久久夜色精品| 欧美在线观看视频一区二区| 欧美1区2区3区| 久久国产精品久久久久久| 免费成人高清| 久久久久久久网站| 欧美性猛交xxxx乱大交蜜桃| 男同欧美伦乱| 国产嫩草影院久久久久| 亚洲三级免费观看| 国内精品视频在线播放| 亚洲深夜福利视频| 亚洲乱码国产乱码精品精| 欧美一级片久久久久久久 | 国产精品播放| 亚洲日本免费电影| 91久久精品一区二区别| 久久不射中文字幕| 久久国产主播精品| 国产精品萝li| 99精品国产在热久久下载| 亚洲国产视频一区| 久久久久久久999| 久久精品夜色噜噜亚洲a∨| 欧美天天综合网| 亚洲乱码精品一二三四区日韩在线| 极品少妇一区二区| 久久不射电影网| 久久久久久亚洲精品不卡4k岛国| 国产精品www色诱视频| 亚洲免费播放| 亚洲精品乱码久久久久久日本蜜臀| 久久久久国产一区二区| 久久最新视频| 亚洲电影在线| 免费欧美电影| 亚洲黄色免费电影| 99一区二区| 欧美三级欧美一级| 一区二区三区国产精品| 亚洲欧美日韩国产一区二区| 欧美视频日韩视频在线观看| 夜夜嗨一区二区三区| 亚洲自拍偷拍福利| 国产精品揄拍一区二区| 性欧美长视频| 美女视频黄 久久| 亚洲卡通欧美制服中文| 欧美日本一区| 亚洲无线观看| 久久这里只有精品视频首页| 亚洲大片在线观看| 欧美美女视频| 亚洲欧美日韩在线综合| 久久久青草婷婷精品综合日韩| 一区在线免费观看| 欧美猛交免费看| 午夜国产一区| 欧美激情一区| 亚洲专区在线视频| 精品1区2区3区4区| 欧美1区3d| 一区二区日韩精品| 国产亚洲欧美一区在线观看| 久久久久国产精品一区二区| 亚洲激情不卡| 欧美在线免费视屏| 亚洲美女视频在线观看| 国产精品区一区二区三| 久久精品国产亚洲5555| 亚洲免费观看高清在线观看| 久久超碰97人人做人人爱| 亚洲国产精品久久久久婷婷老年| 欧美日韩精品免费观看| 久久成人精品视频| 日韩亚洲欧美成人| 美女图片一区二区| 亚洲永久免费av| 亚洲国产精选| 国产一区二区三区成人欧美日韩在线观看 | 久久久久久久一区二区| 日韩视频在线你懂得| 玖玖玖国产精品| 亚洲一区精品在线| 91久久线看在观草草青青| 国产精品一二三四区| 欧美精品亚洲| 久久亚洲免费| 欧美一区三区二区在线观看| 日韩一级片网址| 亚洲二区三区四区| 久久中文久久字幕| 久久国产精品黑丝| 亚洲一区免费视频| 一本大道av伊人久久综合| 在线观看成人网| 国产综合色产| 国产乱码精品一区二区三区不卡| 欧美精品18| 欧美激情中文不卡| 欧美成人国产| 每日更新成人在线视频| 久久久www成人免费无遮挡大片| 亚洲一区二区三区中文字幕在线| 亚洲免费福利视频| 亚洲黄页一区| 亚洲精品影院| 日韩午夜电影在线观看| 亚洲精品日日夜夜| 亚洲精品乱码久久久久久久久 | 在线视频一区观看| 一区二区三区久久久| 亚洲美女少妇无套啪啪呻吟| 亚洲激情一区| 亚洲日本成人在线观看| 亚洲黄色在线| 夜夜嗨av一区二区三区网站四季av| 亚洲国产精品va在线看黑人| 欧美激情网友自拍| 亚洲日本黄色| 夜夜狂射影院欧美极品| 亚洲性线免费观看视频成熟| 一区二区三区国产在线观看| 亚洲午夜伦理| 欧美在线观看视频一区二区三区 | 欧美视频手机在线| 国产伦精品一区二区三区视频孕妇 | 亚洲精选视频免费看| 亚洲激情视频网| 一本一本久久a久久精品牛牛影视| 亚洲欧洲日产国产综合网| 亚洲精选视频免费看| 一区二区三区黄色| 欧美一区二区三区久久精品| 久久久99免费视频| 亚洲第一黄网| 亚洲最快最全在线视频| 校园激情久久| 久久艳片www.17c.com| 欧美日韩国产不卡在线看| 国产精品久久久久久超碰| 国内在线观看一区二区三区| 亚洲国产欧美在线| 午夜久久久久久| 欧美va亚洲va国产综合| 99精品99| 久久日韩粉嫩一区二区三区| 欧美日韩高清在线| 国产一区999| 一区二区三区欧美视频| 久久看片网站| 夜夜嗨av一区二区三区中文字幕 | 另类图片国产| 国产精品综合av一区二区国产馆| 黄色欧美成人| 亚洲一区在线看| 亚洲第一在线综合网站| 亚洲一区三区在线观看| 免费人成精品欧美精品| 国产欧美一区二区三区在线看蜜臀| 亚洲第一级黄色片| 久久国产精品久久w女人spa| 亚洲国产高清自拍| 欧美综合国产| 国产精品久久久久免费a∨| 亚洲欧洲日本mm| 久久亚洲色图| 亚洲自拍电影| 欧美特黄一级| av成人老司机| 亚洲风情在线资源站| 久久精品青青大伊人av| 欧美日韩在线精品| 亚洲国产另类 国产精品国产免费| 欧美综合国产|