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

那誰(shuí)的技術(shù)博客

感興趣領(lǐng)域:高性能服務(wù)器編程,存儲(chǔ),算法,Linux內(nèi)核
隨筆 - 210, 文章 - 0, 評(píng)論 - 1183, 引用 - 0
數(shù)據(jù)加載中……

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 那誰(shuí) 閱讀(4133) 評(píng)論(1)  編輯 收藏 引用 所屬分類(lèi): ccache

評(píng)論

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

開(kāi)源,大力支持啊!
中國(guó)缺少這樣的東西
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>
            午夜精品久久久99热福利| 亚洲一区二区不卡免费| 美女久久网站| 亚洲国产精品久久| 亚洲免费观看高清完整版在线观看| 欧美高清在线视频| 一片黄亚洲嫩模| 久久大逼视频| 亚洲第一搞黄网站| 欧美精品电影| 亚洲欧美日韩在线一区| 欧美成人一区二区三区| 中文无字幕一区二区三区| 99在线精品观看| 久久久精品一区| 亚洲精品综合久久中文字幕| 国产精品成人一区| 久久久青草婷婷精品综合日韩| 亚洲国产日韩欧美在线图片| 亚洲女与黑人做爰| 亚洲第一精品夜夜躁人人躁| 欧美日韩亚洲免费| 久久久精品国产99久久精品芒果| 91久久在线观看| 久久躁日日躁aaaaxxxx| 一本久久综合亚洲鲁鲁五月天| 久久在线免费观看| 麻豆成人在线播放| 亚洲丝袜av一区| 在线观看欧美激情| 欧美日韩中文字幕在线| 久久久久久欧美| 亚洲手机成人高清视频| 欧美国产日本| 久久福利资源站| 在线视频日韩| 亚洲电影免费观看高清完整版| 国产精品成人va在线观看| 免费观看成人| 欧美在线一区二区三区| 夜夜爽夜夜爽精品视频| 欧美jizzhd精品欧美巨大免费| 午夜欧美电影在线观看| 亚洲美女视频在线观看| 在线观看中文字幕不卡| 国产欧美日韩三级| 国产精品av免费在线观看| 欧美成人午夜激情| 久久久久久97三级| 欧美一级夜夜爽| 亚洲视频精品在线| 日韩视频在线免费观看| 欧美激情一区二区三区在线视频观看| 久久久久88色偷偷免费| 欧美自拍偷拍| 性高湖久久久久久久久| 亚洲免费伊人电影在线观看av| 亚洲免费av片| 亚洲精一区二区三区| 亚洲黄色成人久久久| 国内精品久久久久久久影视麻豆| 国产伦精品一区二区三区视频黑人| 欧美日韩国产va另类| 欧美国产日产韩国视频| 美女网站在线免费欧美精品| 久久中文精品| 狂野欧美一区| 欧美成人精品h版在线观看| 老司机精品导航| 免费日韩成人| 暖暖成人免费视频| 欧美精品乱码久久久久久按摩| 免费观看亚洲视频大全| 欧美激情一区在线观看| 欧美麻豆久久久久久中文| 欧美激情亚洲激情| 欧美日韩一区在线播放| 国产精品久久国产三级国电话系列| 欧美视频在线观看一区二区| 国产精品yjizz| 国产精品永久免费视频| 国产一区二区激情| 狠狠爱成人网| 亚洲国产精品一区二区第一页 | 一区二区精品国产| 宅男噜噜噜66国产日韩在线观看| 中文一区在线| 午夜精品www| 久久亚洲精选| 欧美久久久久久久| 国产精品美女主播| 国内精品亚洲| 99精品99| 久久国产精品99精品国产| 久久艳片www.17c.com| 欧美激情亚洲另类| av成人毛片| 欧美在线一区二区三区| 欧美多人爱爱视频网站| 欧美午夜精品一区| 悠悠资源网久久精品| 日韩天天综合| 久久国内精品视频| 亚洲高清视频一区二区| 亚洲午夜高清视频| 久久一区二区三区国产精品| 欧美日韩中文字幕综合视频| 国产亚洲人成网站在线观看| 亚洲国产欧美一区二区三区久久| 在线视频中文亚洲| 久久综合给合| 一区二区三区产品免费精品久久75 | 欧美影院视频| 欧美日韩你懂的| 国产在线观看91精品一区| 亚洲精品中文字幕女同| 欧美在线短视频| 最新国产成人av网站网址麻豆| 亚洲一区二区视频在线| 鲁大师影院一区二区三区| 国产精品久久久久av| 亚洲国产精品日韩| 久久精品国产第一区二区三区最新章节 | 亚洲日本在线观看| 尤妮丝一区二区裸体视频| 一区二区三区欧美亚洲| 免费不卡在线观看av| 中文亚洲免费| 欧美精品在线免费播放| 精品福利免费观看| 午夜免费电影一区在线观看| 欧美激情在线观看| 欧美在线视频一区二区| 欧美视频日韩视频在线观看| 亚洲成人在线视频网站| 久久99在线观看| 一区二区三区欧美视频| 欧美成人一二三| 狠狠色丁香婷婷综合影院| 亚洲欧美制服另类日韩| 亚洲精品专区| 欧美va天堂| 亚洲国产精品999| 久久偷看各类wc女厕嘘嘘偷窃| 亚洲一区二区三区涩| 欧美日韩在线观看视频| 日韩亚洲在线观看| 亚洲国产高清自拍| 快播亚洲色图| 亚洲国产91精品在线观看| 久久亚洲精选| 久久成人免费| 欧美激情在线播放| 91久久久亚洲精品| 狂野欧美一区| 久久精品成人欧美大片古装| 国产午夜亚洲精品不卡| 午夜在线不卡| 亚洲欧美日韩另类| 国产精品视频1区| 亚洲欧美在线观看| 亚洲综合国产| 国产精品一区2区| 欧美在线影院| 欧美一区二区三区另类| 国产婷婷一区二区| 久久精品国产综合精品| 欧美有码在线观看视频| 精品999网站| 免费视频一区| 欧美xx视频| 一本色道久久综合亚洲精品婷婷| 日韩天堂在线观看| 欧美丝袜一区二区三区| 亚洲欧美日韩综合国产aⅴ| 亚洲免费在线播放| 国产综合色产| 欧美国产免费| 欧美日韩一区二区在线视频| 亚洲宅男天堂在线观看无病毒| 亚洲网站在线观看| 国产欧美一区二区色老头| 久久久蜜桃精品| 欧美成人中文字幕在线| 正在播放亚洲一区| 欧美亚洲免费| 亚洲国产专区校园欧美| 夜夜精品视频一区二区| 国产午夜精品久久久| 欧美大片一区| 欧美性一区二区| 久久免费少妇高潮久久精品99| 久久综合狠狠综合久久综青草| 亚洲乱码一区二区| 亚洲一区二区精品视频| 黄色一区二区三区| 日韩视频在线观看| 国外成人网址| 99国内精品久久| 在线观看亚洲视频|