本网页所有文字内容由 imapbox邮箱云存储,邮箱网盘, iurlBox网页地址收藏管理器 下载并得到。
ImapBox 邮箱网盘 工具地址: https://www.imapbox.com/download/ImapBox.5.5.1_Build20141205_CHS_Bit32.exe
PC6下载站地址:PC6下载站分流下载
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox 网页视频 工具地址: https://www.imapbox.com/download/ImovieBox4.7.0_Build20141115_CHS.exe
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
 
 
 
 
 本文原创为freas_1990,转载请表明出处:https://blog.csdn.net/freas_1990/article/details/42052813     Redis的某一个key的value被swap到文件上的时候,该key的value指向的RedisObject将会改变成VMPointer,VMPointer保存了该value在磁盘文件上的信息,包括起始页面的偏移和连续的页面数等。  
typedef struct redisObject {     unsigned type:4;     unsigned storage:2;     /* REDIS_VM_MEMORY or REDIS_VM_SWAPPING */     unsigned encoding:4;     unsigned lru:22;        /* lru time (relative to server.lruclock) */     int refcount;     void *ptr;     /* VM fields are only allocated if VM is active, otherwise the      * object allocation function will just allocate      * sizeof(redisObjct) minus sizeof(redisObjectVM), so using      * Redis without VM active will not have any overhead. */ } robj;
typedef struct vmPointer {     unsigned type:4;     unsigned storage:2; /* REDIS_VM_SWAPPED or REDIS_VM_LOADING */     unsigned notused:26;     unsigned int vtype; /* type of the object stored in the swap file */     off_t page;         /* the page at witch the object is stored on disk */     off_t usedpages;    /* number of pages used on disk */ } vmpointer;
将该key的value导入内存的逻辑如下:
robj *vmReadObjectFromSwap(off_t page, int type) {     robj *o;      if (server.vm_enabled) pthread_mutex_lock(&server.io_swapfile_mutex);     if (fseeko(server.vm_fp,page*server.vm_page_size,SEEK_SET) == -1) {         redisLog(REDIS_WARNING,             "Unrecoverable VM problem in vmReadObjectFromSwap(): can't seek: %s",             strerror(errno));         _exit(1);     }     o = rdbLoadObject(type,server.vm_fp);     if (o == NULL) {         redisLog(REDIS_WARNING, "Unrecoverable VM problem in vmReadObjectFromSwap(): can't load object from swap file: %s", strerror(errno));         _exit(1);     }     if (server.vm_enabled) pthread_mutex_unlock(&server.io_swapfile_mutex);     return o; }
到这里,redis VM的精髓已经点破了,懂了吧?
阅读和此文章类似的: 程序员专区
 官方软件产品操作指南 (170)
官方软件产品操作指南 (170)