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

那誰的技術博客

感興趣領域:高性能服務器編程,存儲,算法,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>
            欧美激情bt| 亚洲欧洲一区二区三区久久| 国内外成人免费激情在线视频| 亚洲一区制服诱惑| 一区二区三区日韩| 国产综合av| 久久国产主播| 久久婷婷国产综合国色天香| 久久疯狂做爰流白浆xx| 久久国产福利国产秒拍| 久久亚洲免费| 欧美视频不卡中文| 国产一区二区精品久久| 亚洲国产日韩美| 一区二区免费在线观看| 亚洲欧美日韩国产综合在线 | 国产婷婷色一区二区三区在线| 国产视频一区欧美| 亚洲免费av网站| 欧美亚洲在线| 亚洲国产精品久久久久婷婷884| 日韩系列在线| 久久久久久**毛片大全| 欧美日韩另类字幕中文| 国产嫩草影院久久久久| 最新国产乱人伦偷精品免费网站| 亚洲综合电影一区二区三区| 欧美成人午夜激情在线| 亚洲一区二区三区色| 欧美电影电视剧在线观看| 国产精品久久久久久久久久免费看 | 亚洲欧洲日韩女同| 欧美一级一区| 亚洲欧洲日本国产| 欧美一区二区三区婷婷月色| 欧美屁股在线| 亚洲高清一区二| 欧美一区1区三区3区公司| 亚洲国产日韩美| 久久国产欧美| 国产精品网站一区| 国产精品99久久久久久人 | 夜夜爽99久久国产综合精品女不卡 | 亚洲网站在线观看| 欧美高清视频在线播放| 午夜精品久久久久久久久久久久| 欧美日韩一区二区三区在线看 | 国产精品五月天| 中文亚洲视频在线| 亚洲国产清纯| 欧美高清视频在线| 亚洲三级免费| 亚洲欧美日韩国产精品 | 在线亚洲高清视频| 欧美成在线视频| 91久久夜色精品国产网站| 久久亚洲二区| 欧美一区二区三区在线免费观看| 亚洲黄色成人久久久| 久久尤物视频| 亚洲第一网站免费视频| 你懂的国产精品永久在线| 久久久久久穴| 亚洲国产欧美一区| 欧美黄色aa电影| 欧美大片在线观看一区| 亚洲毛片一区| 99热在这里有精品免费| 国产精品99免费看| 欧美在线一区二区三区| 欧美一区二区三区免费在线看| 国产亚洲成精品久久| 久久在线观看视频| 久久久无码精品亚洲日韩按摩| 亚洲成人在线观看视频| 亚洲福利在线视频| 欧美日韩亚洲免费| 午夜精品久久99蜜桃的功能介绍| 亚洲一区二区在线免费观看| 国产日本欧洲亚洲| 欧美成在线视频| 欧美日韩1080p| 性色av一区二区怡红| 久久精品国产99精品国产亚洲性色 | 一片黄亚洲嫩模| 欧美性色视频在线| 久久夜色精品国产亚洲aⅴ| 久久亚洲私人国产精品va| 亚洲精品欧美精品| 亚洲素人一区二区| 1024精品一区二区三区| 日韩午夜三级在线| 亚洲免费视频在线观看| 国产综合自拍| 亚洲精品一区在线观看香蕉| 国产精品蜜臀在线观看| 欧美国产精品久久| 国产精品久久久999| 欧美a级一区二区| 欧美日韩在线观看一区二区| 久久青草久久| 欧美日韩亚洲精品内裤| 开元免费观看欧美电视剧网站| 欧美第一黄网免费网站| 久久青青草综合| 欧美日韩一区成人| 欧美777四色影视在线| 国产精品老女人精品视频| 欧美不卡一区| 国产亚洲成av人在线观看导航| 亚洲欧洲精品一区二区| 激情成人在线视频| 999亚洲国产精| 欧美在线视频日韩| 亚洲三级电影全部在线观看高清| 在线一区二区三区做爰视频网站| 国产综合久久久久久鬼色| 亚洲精品中文字幕在线观看| 韩国av一区二区三区| 亚洲一区国产视频| 久久字幕精品一区| 久久国产夜色精品鲁鲁99| 欧美精品少妇一区二区三区| 欧美不卡视频一区发布| 国内精品久久久| 亚洲欧美乱综合| 亚洲婷婷免费| 欧美日韩一区不卡| 日韩写真在线| 一本久久综合亚洲鲁鲁五月天| 久久婷婷激情| 欧美国产日韩一区二区| 尹人成人综合网| 久久久精品tv| 欧美成人精品在线观看| 在线不卡欧美| 久久久久国产一区二区| 看片网站欧美日韩| 伊甸园精品99久久久久久| 欧美一区二区三区成人| 久久精品国产免费看久久精品| 国产精品人人做人人爽人人添| 日韩视频一区二区三区| 亚洲一区二区三区国产| 国产精品高潮久久| 亚洲永久免费视频| 欧美在线视频一区二区三区| 国产日韩欧美中文| 久久久97精品| 亚洲精品乱码久久久久久久久| av成人免费在线| 国产精品国色综合久久| 午夜精品久久久久久久白皮肤 | 日韩一级精品| 国产精品久久福利| 欧美一区二区三区视频免费播放| 久久久久网址| 亚洲人屁股眼子交8| 欧美性大战xxxxx久久久| 在线一区欧美| 国产欧美综合在线| 久久久亚洲国产美女国产盗摄| 亚洲黄色av一区| 亚洲欧美日韩人成在线播放| 国产一区二区激情| 欧美jizzhd精品欧美喷水| 一区二区三区高清在线观看| 久久日韩精品| 一区二区三区**美女毛片| 国产精品亚洲人在线观看| 久久在线视频在线| 一区二区欧美日韩| 老鸭窝91久久精品色噜噜导演| 99re6热只有精品免费观看| 国产亚洲精品aa午夜观看| 免费在线亚洲| 亚洲免费人成在线视频观看| 欧美国产欧美综合| 欧美亚洲午夜视频在线观看| 欧美一区二区三区在线观看视频| 国产真实乱偷精品视频免| 欧美黄色aaaa| 久久电影一区| 亚洲一区二区三区精品视频| 欧美激情麻豆| 久久国产一区二区| 亚洲视频大全| 最新中文字幕亚洲| 激情欧美日韩| 国产精品裸体一区二区三区| 免费欧美日韩国产三级电影| 香蕉成人啪国产精品视频综合网| 亚洲高清资源| 欧美高清在线视频| 久久久噜噜噜| 久久成人久久爱| 亚洲一区免费看| 亚洲免费观看在线观看| 亚洲第一搞黄网站| 精品动漫一区二区|