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

那誰的技術博客

感興趣領域:高性能服務器編程,存儲,算法,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>
            精品69视频一区二区三区| 亚洲欧美综合| 欧美不卡一卡二卡免费版| 亚洲二区在线观看| 欧美ed2k| 女人天堂亚洲aⅴ在线观看| 亚洲国产高清一区二区三区| 欧美高清在线观看| 欧美日韩国产成人在线免费| 亚洲午夜国产成人av电影男同| 亚洲午夜久久久久久久久电影院| 国产精品亚洲产品| 另类av一区二区| 欧美激情一区二区三区全黄| 亚洲尤物在线视频观看| 久久不射网站| 亚洲日韩中文字幕在线播放| 亚洲另类一区二区| 国产视频在线一区二区| 欧美不卡福利| 国产精品久久波多野结衣| 久久久久久久波多野高潮日日| 久久久久久亚洲精品中文字幕| 亚洲免费av片| 欧美一二区视频| 亚洲黄色小视频| 亚洲中字在线| 亚洲人体大胆视频| 亚洲欧美久久久| 99成人免费视频| 欧美自拍偷拍| 午夜国产精品视频免费体验区| 欧美在线免费观看亚洲| 在线午夜精品| 久久综合九色九九| 欧美一级电影久久| 欧美人与禽性xxxxx杂性| 久久噜噜亚洲综合| 国产精品v片在线观看不卡| 另类春色校园亚洲| 国产欧美精品国产国产专区| 亚洲人妖在线| 国产一区二区三区久久久| 亚洲美女色禁图| 亚洲国产综合在线看不卡| 欧美一级欧美一级在线播放| 99国产精品久久久久老师| 久久青青草原一区二区| 午夜精品久久久久99热蜜桃导演| 美日韩在线观看| 久久亚洲综合网| 国产丝袜一区二区| 亚洲主播在线观看| 亚洲综合精品四区| 欧美区在线播放| 亚洲精品五月天| 亚洲人人精品| 欧美精品1区2区| 欧美成人久久| 亚洲第一黄色| 老司机精品福利视频| 久久久99免费视频| 国产曰批免费观看久久久| 亚洲欧美视频一区二区三区| 亚洲欧美久久久久一区二区三区| 欧美国产日本韩| 亚洲精品黄网在线观看| 99国产一区| 欧美日韩在线综合| 在线视频亚洲一区| 亚洲欧美日韩在线不卡| 国产精品美女久久久久久免费| 亚洲性夜色噜噜噜7777| 欧美在线亚洲| 激情校园亚洲| 欧美夫妇交换俱乐部在线观看| 欧美黑人在线观看| 99天天综合性| 国产精品国码视频| 羞羞答答国产精品www一本| 久久久国产精品亚洲一区 | 欧美精品情趣视频| 999亚洲国产精| 欧美亚洲综合另类| 久久久久国产一区二区三区| 国内久久视频| 欧美成人精品高清在线播放| 亚洲精品少妇30p| 欧美伊久线香蕉线新在线| 韩国成人精品a∨在线观看| 欧美第一黄网免费网站| 一区二区三区精品视频在线观看| 欧美一区二区视频在线| 很黄很黄激情成人| 欧美激情综合| 欧美一区=区| 亚洲激情偷拍| 欧美在线观看视频一区二区| 亚洲国产精品传媒在线观看| 久久精品国产久精国产爱| 欧美成人一区二区| 午夜精品视频在线观看| 一区二区视频免费完整版观看| 欧美日韩xxxxx| 欧美一区二区三区视频免费播放| 欧美高清一区| 欧美自拍偷拍午夜视频| 亚洲免费观看高清完整版在线观看| 国产精品ⅴa在线观看h| 另类综合日韩欧美亚洲| 亚洲免费在线视频| 亚洲欧洲综合另类| 久久人人九九| 欧美一级黄色录像| 制服丝袜激情欧洲亚洲| 在线免费观看日本一区| 欧美小视频在线| 欧美精品电影| 久久人人爽人人爽| 亚洲欧美日韩一区二区三区在线观看| 欧美黄色小视频| 久久三级福利| 欧美影院成人| 亚洲欧美视频一区| 亚洲私人影院| 亚洲理论在线观看| 国语对白精品一区二区| 国产免费亚洲高清| 欧美香蕉大胸在线视频观看| 欧美日韩国产一中文字不卡| 欧美成人久久| 麻豆精品一区二区av白丝在线| 亚洲欧美影院| 亚洲欧美日韩在线不卡| 99亚洲视频| 亚洲精品一级| 亚洲另类在线一区| 亚洲毛片在线| 一区二区三区国产精华| 日韩视频一区| 一区二区三区不卡视频在线观看| 亚洲欧洲日产国码二区| 最新国产乱人伦偷精品免费网站| 精品999在线观看| 亚洲成人直播| 亚洲大胆在线| 亚洲毛片在线看| 亚洲理伦在线| 亚洲一本大道在线| 亚洲欧美日韩在线不卡| 欧美在线观看天堂一区二区三区| 欧美在线播放视频| 免费日韩av片| 欧美激情第9页| 最新精品在线| 一区二区三区日韩精品| 亚洲在线播放电影| 欧美一区二区三区四区夜夜大片| 亚洲免费一级电影| 久久亚洲私人国产精品va媚药| 鲁大师影院一区二区三区| 欧美高清视频一二三区| 欧美三区不卡| 国产亚洲精品成人av久久ww| 永久免费视频成人| 久久久久久久久久久一区| 欧美国产日本高清在线| 国产精品国产成人国产三级| 国产伦精品一区二区三区| 激情亚洲网站| 亚洲天堂成人在线观看| 久久精品视频在线| 亚洲国产视频一区二区| 亚洲婷婷在线| 麻豆国产精品777777在线| 欧美激情一区二区三区在线视频| 欧美日韩无遮挡| 国产一区二区三区自拍| 亚洲人成亚洲人成在线观看图片| 亚洲午夜精品久久久久久浪潮 | 亚洲乱亚洲高清| 亚洲一区在线免费| 久久亚洲午夜电影| 99国产精品久久久| 久久久久久免费| 国产精品久久久久久久午夜片| 激情丁香综合| 亚洲欧美国内爽妇网| 欧美高清在线精品一区| 午夜国产精品视频免费体验区| 久久亚洲精品网站| 国产乱码精品一区二区三| 亚洲精品国产精品久久清纯直播 | 中文精品在线| 欧美xart系列在线观看| 亚洲午夜日本在线观看| 欧美激情中文不卡| 一区二区三区中文在线观看| 午夜精品av| 一区二区三区免费看|