idv2.com
目 录
译者序..................................................................................................................................................4
第 1 章 memcached 的基础.................................................................................................................5
1.1 memcached 是什么?...............................................................................................................5
1.2 memcached 的特征...................................................................................................................6
协议简单.....................................................................................................................................6
基于 libevent 的事件处理..........................................................................................................6
内置内存存储方式.....................................................................................................................6
memcached 不互相通信的分布式.............................................................................................6
1.3 安装 memcached.......................................................................................................................7
memcached 的安装.....................................................................................................................7
memcached 的启动.....................................................................................................................8
1.4 用客户端连接...........................................................................................................................8
1.5 使用 Cache::Memcached..........................................................................................................9
使用 Cache::Memcached 连接 memcached................................................................................9
保存数据...................................................................................................................................10
获取数据...................................................................................................................................10
删除数据...................................................................................................................................10
增一和减一操作.......................................................................................................................10
1.6 总结.........................................................................................................................................11
第 2 章 理解 memcached 的内存存储..............................................................................................12
2.1 Slab Allocation 机制:整理内存以便重复使用...................................................................12
Slab Allocation 的主要术语.....................................................................................................13
2.2 在 Slab 中缓存记录的原理....................................................................................................13
2.3 Slab Allocator 的缺点.............................................................................................................13
2.4 使用 Growth Factor 进行调优................................................................................................14
2.5 查看 memcached 的内部状态................................................................................................15
2.6 查看 slabs 的使用状况...........................................................................................................16
2.7 总结.........................................................................................................................................17
第 3 章 memcached 的删除机制和发展方向...................................................................................18
3.1 memcached 在数据删除方面有效利用资源.........................................................................18
数据不会真正从 memcached 中消失......................................................................................18
Lazy Expiration.........................................................................................................................18
3.2 LRU:从缓存中有效删除数据的原理.................................................................................18
3.3 memcached 的最新发展方向.................................................................................................18
关于二进制协议.......................................................................................................................19
二进制协议的格式...................................................................................................................19
HEADER 中引人注目的地方..................................................................................................20
2