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

那誰的技術(shù)博客

感興趣領(lǐng)域:高性能服務(wù)器編程,存儲,算法,Linux內(nèi)核
隨筆 - 210, 文章 - 0, 評論 - 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 那誰 閱讀(4133) 評論(1)  編輯 收藏 引用 所屬分類: ccache

評論

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

開源,大力支持啊!
中國缺少這樣的東西
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>
            欧美高清视频一区二区| 欧美网站在线观看| 亚洲一级片在线观看| 久久综合久久综合久久综合| 亚洲欧美一区二区在线观看| 亚洲综合另类| 激情校园亚洲| 欧美高清一区二区| 欧美精品一区在线发布| 毛片精品免费在线观看| 国产欧美日韩一区| 欧美激情1区2区| 红桃视频成人| 欧美一区日韩一区| 欧美一区在线看| 老司机免费视频一区二区| 亚洲精品国产精品久久清纯直播 | 欧美国产日韩一区二区在线观看 | 欧美激情aⅴ一区二区三区| 国产一级揄自揄精品视频| 亚洲尤物视频网| 欧美一区二区三区免费在线看 | 久久黄色级2电影| 国产精品成人国产乱一区| 久久精品日产第一区二区| 国产精品视频免费观看www| 亚洲一区免费| 在线观看视频一区| 久久婷婷激情| 亚洲激情午夜| 日韩网站在线| 欧美日韩午夜精品| 亚洲午夜一二三区视频| 亚洲高清视频一区| 免费看黄裸体一级大秀欧美| 亚洲欧美久久| 欧美国产视频日韩| 久久久久久亚洲精品中文字幕| 国产精品综合网站| 欧美在线视频不卡| 欧美wwwwww| 国内成人精品2018免费看| 日韩一级在线观看| 亚洲欧洲日产国产综合网| 欧美日本一区二区高清播放视频| 久久成年人视频| 黄色亚洲网站| 亚洲影视在线| 免费观看久久久4p| 亚洲久久一区二区| 久久综合九九| 久久久人成影片一区二区三区| 在线国产日韩| 久久国产精品99国产| 午夜欧美视频| 欧美极品一区| 亚洲欧美自拍偷拍| 欧美1区视频| 尤物99国产成人精品视频| 欧美精品色综合| 欧美黄色片免费观看| 韩国精品主播一区二区在线观看| 麻豆9191精品国产| 免费成人美女女| 亚洲欧美日韩国产一区| 亚洲高清在线精品| 国产精品欧美久久| 免费看黄裸体一级大秀欧美| 欧美11—12娇小xxxx| 亚洲高清网站| 欧美99久久| 亚洲第一区色| 久久国产高清| 韩日精品视频| 欧美日韩免费一区二区三区| 久久精品一本久久99精品| 在线一区二区日韩| 亚洲国产欧美在线| 日韩一区二区精品视频| 国产一区二区三区在线播放免费观看 | 欧美激情亚洲一区| 欧美伊人久久久久久久久影院| 最近中文字幕日韩精品| 国产一区在线免费观看| 欧美日韩一区二区高清| 欧美成人国产va精品日本一级| 欧美综合国产精品久久丁香| 中国成人在线视频| 午夜久久电影网| 国产精品99久久久久久久vr | 亚洲国产精品一区二区第四页av| 亚洲激情视频网| 国产亚洲在线观看| 国产农村妇女精品一区二区| 欧美一区国产一区| 亚洲欧美福利一区二区| 亚洲视频在线观看三级| 久久精品免费| 欧美在线一二三| 午夜精品久久久久久久白皮肤 | 欧美日韩综合视频网址| 女人色偷偷aa久久天堂| 久久久综合网| 99热免费精品| 99xxxx成人网| 久久免费99精品久久久久久| 亚洲人久久久| 国产精品视频久久一区| 久久久噜噜噜久久中文字幕色伊伊| 欧美黑人国产人伦爽爽爽| 美女脱光内衣内裤视频久久影院| 亚洲久久成人| 国产亚洲精品久久久| 国产欧美在线看| 欧美电影打屁股sp| 欧美精品18| 欧美日韩国产欧| 欧美视频精品在线| 国产精品自拍一区| 国产一区二区欧美日韩| 欧美精品一区二区三区一线天视频 | 久久久99精品免费观看不卡| 亚洲精品欧美| 一本色道久久88综合亚洲精品ⅰ| 日韩午夜激情av| 亚洲欧美一区二区精品久久久| 欧美一区二区三区视频在线观看 | 国产日韩欧美在线视频观看| 国产亚洲一区在线播放| 亚洲第一在线| 亚洲视频免费在线| 欧美一区二区三区四区在线观看| 亚洲精品视频在线观看免费| 国产一区91精品张津瑜| 国产精品啊啊啊| 国产三级欧美三级日产三级99| 欧美日韩国产影片| 欧美 日韩 国产 一区| 久久se精品一区二区| 久久久久综合网| 欧美日韩成人在线| 国产亚洲欧美激情| 国产欧美在线| 亚洲精品三级| 亚洲国产欧美国产综合一区| 亚洲天堂免费观看| 麻豆精品在线视频| 一区二区三区四区五区视频| 欧美在线视频二区| 欧美日韩亚洲国产一区| 韩日午夜在线资源一区二区| 国产亚洲一区二区三区| 亚洲精品小视频在线观看| 欧美一区二区日韩一区二区| 亚洲丁香婷深爱综合| 香蕉久久一区二区不卡无毒影院 | 欧美日韩高清免费| 欧美精品自拍| 欧美日韩1234| 欧美日韩高清一区| 欧美系列一区| 国产精品二区在线| 亚洲激情在线| 一二三区精品| 欧美jizzhd精品欧美巨大免费| 亚洲社区在线观看| 欧美成人精品h版在线观看| 欧美成人午夜| 激情小说另类小说亚洲欧美| 精品动漫av| 亚洲另类一区二区| 久久综合中文| 亚洲国产高清在线观看视频| 亚洲欧洲一区| 亚洲一区二区免费| 欧美在线免费视屏| 牛人盗摄一区二区三区视频| 欧美国产综合视频| 亚洲高清免费在线| 久久中文精品| 最新中文字幕亚洲| 麻豆成人小视频| 亚洲国产高清自拍| 嫩模写真一区二区三区三州| 午夜免费日韩视频| 国产嫩草一区二区三区在线观看| 亚洲永久字幕| 亚洲一二三区视频在线观看| 久久精品99久久香蕉国产色戒| 美女脱光内衣内裤视频久久影院| 国产欧美日韩一区二区三区在线| 在线播放日韩专区| 久久天堂成人| 久久免费视频一区| 一区久久精品| 亚洲成人在线视频网站| 亚洲一区三区电影在线观看| 国产精品a久久久久| 香蕉成人伊视频在线观看| 欧美成人午夜影院|