转自:原链接

使用命令 set(key, value) 向 memcached 插入一条数据, memcached 内部是如何组织数据呢

一 把数据组装成 item

memcached 接受到客户端的数据后, 把数据组装成 item, item 的格式如下:


    图1 struct item 的结构

CAS可选:cas的版本号

源码中这样定义 struct item:

[cpp] view plaincopy
  1. /**
  2. * Structure for storing items within memcached.
  3. */
  4. typedef struct _stritem {
  5. struct _stritem *next;
  6. struct _stritem *prev;
  7. struct _stritem *h_next;    /* hash chain next */
  8. rel_time_t      time;       /* least recent access */
  9. rel_time_t      exptime;    /* expire time */
  10. int             nbytes;     /* size of data */
  11. unsigned short  refcount;
  12. uint8_t         nsuffix;    /* length of flags-and-length string */
  13. uint8_t         it_flags;   /* ITEM_* above */
  14. uint8_t         slabs_clsid;/* which slab class we're in */
  15. uint8_t         nkey;       /* key length, w/terminating null and padding */
  16. /* this odd type prevents type-punning issues when we do
  17. * the little shuffle to save space when not using CAS. */
  18. union {
  19. uint64_t cas;
  20. char end;
  21. } data[];
  22. /* if it_flags & ITEM_CAS we have 8 bytes CAS */
  23. /* then null-terminated key */
  24. /* then " flags length\r\n" (no terminating null) */
  25. /* then data with terminating \r\n (no terminating null; it's binary!) */
  26. } item;

从源码可以得出 item 的结构分两部分, 第一部分定义 item 结构的属性, 包括连接其它 item 的指针 (next, prev),

还有最近访问时间(time), 过期的时间(exptime), 以及数据部分的大小, 标志位, key的长度, 引用次数, 以及 item 是

从哪个 slabclass 分配而来.

item 结构体的定义使用了一个常用的技巧: 定义空数组 data, 用来指向 item 数据部分的首地址, 使用空数组的

好处是 data 指针本身不占用任何存储空间, 为 item 分配存储空间后, data 自然而然就指向数据部分的首地址.

第二部分是 item 的数据, 由 CAS, key, suffix, value 组成.

二 为 item 分配存储空间

把数据组装成 item 之前, 必须为 item 分配存储空间, memcached 不是直接从操作系统分配内存的, memcached

内部使用了类似内存池的东西, 即slab机制, 来管理内存. 内存的分配和回收都交给 slab 子系统实现. 所以我们先理解

slab, 再回过头来看如何为 item 分配存储空间.

三 使用 slab 管理内存

memcached 中, 内存的分配和回收, 都是通过 slab 实现的, slab机制相当于内存池机制, 实现从操作系统分配一大块

内存, 然后 memcached 自己管理这块内存, 负责分配与回收. 接下来我们详细剖析 slab 机制.

3.1 关于 slabclass

像一般的内存池一样,  从操作系统分配到一大块内存后, 为了方便管理, 把这大块内存划分为各种大小的 chunk,

chunk的大小按照一定比例逐渐递增, 如下图所示:


   图2: 各个 slabclass 的 chunk size 按比例递增

从 slab 分配内存的时候, 根据请求内存块的大小, 找到大小最合适的 chunk 所在的 slabclass, 然后从这个

slabclass 找空闲的 chunk 分配出去. 所谓最合适就是指 chunk 的大小能够满足要求, 而且碎片最小.

如下图所示:

图3 寻找最合适的 slabclass

这种分配方式的缺点是存在内存碎片, 例如, 将 100字节的 item 存储到一个 128 字节的 chunk, 就有 28 字节

的内存浪费, 如下图所示:

图5 内存碎片

3.2 slabclass 的内部实现

slabclass 是由 chunk size 确定的, 同一个 slabclass 内的 chunk 大小都一样,  每一个 slabclass 要负责管理

一些内存, 初始时, 系统为每个 slabclass 分配一个 slab, 一个 slab 就是一个内存块,  其大小等于 1M.  然后每个

slabclass 再把 slab 切分成一个个 chunk, 算一下, 一个 slab 可以切分得到 1M/chunk_size 个chunk.

先来看一下源码中 slabclass 的定义:

[cpp] view plaincopy
  1. typedef struct {
  2. unsigned int size;      /* sizes of items */
  3. unsigned int perslab;   /* how many items per slab */
  4. void *slots;           /* list of item ptrs */
  5. unsigned int sl_curr;   /* total free items in list */
  6. void *end_page_ptr;         /* pointer to next free item at end of page, or 0 */
  7. unsigned int end_page_free; /* number of items remaining at end of last alloced page */
  8. unsigned int slabs;     /* how many slabs were allocated for this class */
  9. void **slab_list;       /* array of slab pointers */
  10. unsigned int list_size; /* size of prev array */
  11. unsigned int killing;  /* index+1 of dying slab, or zero if none */
  12. size_t requested; /* The number of requested bytes */
  13. } slabclass_t;

slabclass 的结构图如下所示:

图6 slabclass 结构图

结合 slabclass 的结构图, 我们说明一下 slabclass 结构体的各个属性:

(1) size 和 perslab

size 定义该 slabclass 的 chunk 大小, perslab 表示每个 slab 可以切分成多少个 chunk, 如果一个 slab 等于

1M, 那么就有 perslab = 1M / size

(2) slots 和 sl_curr

slots 是回收的 item 链表, 从某个 slabclass 分配出去一个 item, 当 item 回收的时候,

不是把这 item 使用的内存交还给 slab, 而是让这个 item 挂在 slots 链表的尾部. sl_curr 表示当前链表中

有多少个回收而来的空闲 item.

(3) slab_list 和 list_size

前面说过, 初始时, memcached 为每个 slabclass 分配一个 slab, 当这个 slab 内存块使用完后, memcached

就分配一个新的 slab, 所以 slabclass 可以拥有多个 slab, 这些 slab 就是通过 slab_list 数组来管理的, list_size

表示当前 slabclass 有多少个 slab.

(4) end_page_ptr 和 end_page_free

在 subclass 内, 只有最后一个 slab 存在空闲的内存, 其它 slab 的 chunk 都分配出去了, end_page_ptr

指向最后一个 slab 中的空闲内存块, end_page_free 表示最后一个 slab 中还剩下多少个空闲 chunk.  图6

中绿色部分的 chunk 表示空闲 chunk

(5) static item *heads[LARGEST_ID];

static item *tails[LARGEST_ID];

当 memcached 没有足够的内存使用时, 必须选择性地回收一些 item, 回收采用 LRU 算法, 这就需要维护

一个按照最近访问时间排序的 LRU 队列. 在 memcached 中,

每个 slabclass 维护一个链表, 比如 slabclass[i] 的链表头指针为 heads[i], 尾指针为 tails[i],

已分配出去的 item 都存储在链表中. 而且链表中 item 按照最近访问时间排序, 这样一些链表相当于

LRU 队列.

四 源码分析

4.1 do_slabs_newslab

前面说过每个 slabclass 都拥有一些 slab, 当所有 slab 都用完时, memcached 会给它分配一个新的 slab,

do_slabs_newslab 就是做这个工作的.

[cpp] view plaincopy
  1. static int do_slabs_newslab(const unsigned int id) {
  2. slabclass_t *p = &slabclass[id];
  3. int len = settings.slab_reassign ? settings.item_size_max
  4. : p->size * p->perslab;
  5. char *ptr;
  6. if ((mem_limit && mem_malloced + len > mem_limit && p->slabs > 0) ||
  7. (grow_slab_list(id) == 0) ||
  8. ((ptr = memory_allocate((size_t)len)) == 0)) {
  9. MEMCACHED_SLABS_SLABCLASS_ALLOCATE_FAILED(id);
  10. return 0;
  11. }
  12. memset(ptr, 0, (size_t)len);
  13. p->end_page_ptr = ptr;
  14. p->end_page_free = p->perslab;
  15. p->slab_list[p->slabs++] = ptr;
  16. mem_malloced += len;
  17. MEMCACHED_SLABS_SLABCLASS_ALLOCATE(id);
  18. return 1;
  19. }

分配一个新的 slab, 必须把该 slab 的首地址安插在 slab_list 数组中, 所以先调用 grow_slab_list 来确保 slab_list

数组有足够的容量, 如果容量不足, grow_slab_list 会对 slab_list 扩容.

然后调用 memory_allocate 分配 1M 的内存空间, memory_allocate 从预先分配的内存取下 1M 大小的

空闲内存块,作为新的 slab.

最后调整 end_page_ptr, 新分配的 slab 全部都是空闲内存块, 所以 end_page_ptr 指向新 slab 的首地址.

这个新 slab 的首地址也被安插在 slab_list 数组中.

4.2 do_slabs_alloc

这个函数从指定的 slabclass, 即 slabclass[id], 分配大小为 size 的内存块供申请者使用.

分配的原则是, 优先从 slots 指向的空闲链表中分配, 空闲链表没有, 才从 slab 中分配一个空闲的 chunk.

[cpp] view plaincopy
  1. static void *do_slabs_alloc(const size_t size, unsigned int id) {
  2. slabclass_t *p;
  3. void *ret = NULL;
  4. item *it = NULL;
  5. if (id < POWER_SMALLEST || id > power_largest) {
  6. MEMCACHED_SLABS_ALLOCATE_FAILED(size, 0);
  7. return NULL;
  8. }
  9. p = &slabclass[id];
  10. assert(p->sl_curr == 0 || ((item *)p->slots)->slabs_clsid == 0);
  11. /* 如果不使用 slab 机制, 则直接从操作系统分配 */
  12. #ifdef USE_SYSTEM_MALLOC
  13. if (mem_limit && mem_malloced + size > mem_limit) {
  14. MEMCACHED_SLABS_ALLOCATE_FAILED(size, id);
  15. return 0;
  16. }
  17. mem_malloced += size;
  18. ret = malloc(size);
  19. MEMCACHED_SLABS_ALLOCATE(size, id, 0, ret);
  20. return ret;
  21. #endif
  22. /* fail unless we have space at the end of a recently allocated page,
  23. we have something on our freelist, or we could allocate a new page */
  24. /* 确保最后一个slab 有空闲的chunk */
  25. if (! (p->end_page_ptr != 0 || p->sl_curr != 0 ||
  26. do_slabs_newslab(id) != 0)) {
  27. /* We don't have more memory available */
  28. ret = NULL;
  29. } else if (p->sl_curr != 0) {
  30. /* 从空闲list分配一个item */
  31. /* return off our freelist */
  32. it = (item *)p->slots;
  33. p->slots = it->next;
  34. if (it->next) it->next->prev = 0;
  35. p->sl_curr--;
  36. ret = (void *)it;
  37. } else {
  38. /* 从最后一个slab中分配一个空闲chunk */
  39. /* if we recently allocated a whole page, return from that */
  40. assert(p->end_page_ptr != NULL);
  41. ret = p->end_page_ptr;
  42. if (--p->end_page_free != 0) {
  43. p->end_page_ptr = ((caddr_t)p->end_page_ptr) + p->size;
  44. } else {
  45. p->end_page_ptr = 0;
  46. }
  47. }
  48. if (ret) {
  49. p->requested += size;
  50. MEMCACHED_SLABS_ALLOCATE(size, id, p->size, ret);
  51. } else {
  52. MEMCACHED_SLABS_ALLOCATE_FAILED(size, id);
  53. }
  54. return ret;
  55. }

4.3 do_slabs_free

把 ptr 指向的 item 归还给 slabclass[id]

操作很简单, 把 ptr 指向的 item 挂在 slots 空闲链表的最前面

[cpp] view plaincopy
  1. static void do_slabs_free(void *ptr, const size_t size, unsigned int id) {
  2. slabclass_t *p;
  3. item *it;
  4. assert(((item *)ptr)->slabs_clsid == 0);
  5. assert(id >= POWER_SMALLEST && id <= power_largest);
  6. if (id < POWER_SMALLEST || id > power_largest)
  7. return;
  8. MEMCACHED_SLABS_FREE(size, id, ptr);
  9. p = &slabclass[id];
  10. #ifdef USE_SYSTEM_MALLOC
  11. mem_malloced -= size;
  12. free(ptr);
  13. return;
  14. #endif
  15. /* 把 item 归还给slots指向的空闲链表, 插在链表的最前面 */
  16. it = (item *)ptr;
  17. it->it_flags |= ITEM_SLABBED;
  18. it->prev = 0;
  19. it->next = p->slots;
  20. if (it->next) it->next->prev = it;
  21. p->slots = it;
  22. p->sl_curr++;
  23. p->requested -= size;
  24. return;
  25. }

4.4 do_item_alloc

从 slab 系统分配一个空闲 item

[cpp] view plaincopy
  1. item *do_item_alloc(char *key, const size_t nkey, const int flags, const rel_time_t exptime, const int nbytes) {
  2. uint8_t nsuffix;
  3. item *it = NULL;
  4. char suffix[40];
  5. size_t ntotal = item_make_header(nkey + 1, flags, nbytes, suffix, &nsuffix);
  6. if (settings.use_cas) {
  7. ntotal += sizeof(uint64_t);
  8. }
  9. unsigned int id = slabs_clsid(ntotal);
  10. if (id == 0)
  11. return 0;
  12. mutex_lock(&cache_lock);
  13. /* do a quick check if we have any expired items in the tail.. */
  14. item *search;
  15. rel_time_t oldest_live = settings.oldest_live;
  16. search = tails[id];
  17. if (search != NULL && (refcount_incr(&search->refcount) == 2)) {
  18. /* 先检查 LRU 队列最后一个 item 是否超时, 超时的话就把这个 item 分配给用户 */
  19. if ((search->exptime != 0 && search->exptime < current_time)
  20. || (search->time <= oldest_live && oldest_live <= current_time)) {  // dead by flush
  21. STATS_LOCK();
  22. stats.reclaimed++;
  23. STATS_UNLOCK();
  24. itemstats[id].reclaimed++;
  25. if ((search->it_flags & ITEM_FETCHED) == 0) {
  26. STATS_LOCK();
  27. stats.expired_unfetched++;
  28. STATS_UNLOCK();
  29. itemstats[id].expired_unfetched++;
  30. }
  31. it = search;
  32. slabs_adjust_mem_requested(it->slabs_clsid, ITEM_ntotal(it), ntotal);
  33. /* 把这个 item 从 LRU 队列和哈希表中移除 */
  34. do_item_unlink_nolock(it, hash(ITEM_key(it), it->nkey, 0));
  35. /* Initialize the item block: */
  36. it->slabs_clsid = 0;
  37. /* 没有超时的 item, 那就尝试从 slabclass 分配, 运气不好的话, 分配失败,
  38. 那就把 LRU 队列最后一个 item 剔除, 然后分配给用户 */
  39. } else if ((it = slabs_alloc(ntotal, id)) == NULL) {
  40. if (settings.evict_to_free == 0) {
  41. itemstats[id].outofmemory++;
  42. pthread_mutex_unlock(&cache_lock);
  43. return NULL;
  44. }
  45. itemstats[id].evicted++;
  46. itemstats[id].evicted_time = current_time - search->time;
  47. if (search->exptime != 0)
  48. itemstats[id].evicted_nonzero++;
  49. if ((search->it_flags & ITEM_FETCHED) == 0) {
  50. STATS_LOCK();
  51. stats.evicted_unfetched++;
  52. STATS_UNLOCK();
  53. itemstats[id].evicted_unfetched++;
  54. }
  55. STATS_LOCK();
  56. stats.evictions++;
  57. STATS_UNLOCK();
  58. it = search;
  59. slabs_adjust_mem_requested(it->slabs_clsid, ITEM_ntotal(it), ntotal);
  60. /* 把这个 item 从 LRU 队列和哈希表中移除 */
  61. do_item_unlink_nolock(it, hash(ITEM_key(it), it->nkey, 0));
  62. /* Initialize the item block: */
  63. it->slabs_clsid = 0;
  64. } else {
  65. refcount_decr(&search->refcount);
  66. }
  67. /* LRU 队列是空的, 或者锁住了, 那就只能从 slabclass 分配内存 */
  68. } else {
  69. /* If the LRU is empty or locked, attempt to allocate memory */
  70. it = slabs_alloc(ntotal, id);
  71. if (search != NULL)
  72. refcount_decr(&search->refcount);
  73. }
  74. if (it == NULL) {
  75. itemstats[id].outofmemory++;
  76. /* Last ditch effort. There was a very rare bug which caused
  77. * refcount leaks. We leave this just in case they ever happen again.
  78. * We can reasonably assume no item can stay locked for more than
  79. * three hours, so if we find one in the tail which is that old,
  80. * free it anyway.
  81. */
  82. if (search != NULL &&
  83. search->refcount != 2 &&
  84. search->time + TAIL_REPAIR_TIME < current_time) {
  85. itemstats[id].tailrepairs++;
  86. search->refcount = 1;
  87. do_item_unlink_nolock(search, hash(ITEM_key(search), search->nkey, 0));
  88. }
  89. pthread_mutex_unlock(&cache_lock);
  90. return NULL;
  91. }
  92. assert(it->slabs_clsid == 0);
  93. assert(it != heads[id]);
  94. /* 顺便对 item 做一些初始化 */
  95. /* Item initialization can happen outside of the lock; the item's already
  96. * been removed from the slab LRU.
  97. */
  98. it->refcount = 1;     /* the caller will have a reference */
  99. pthread_mutex_unlock(&cache_lock);
  100. it->next = it->prev = it->h_next = 0;
  101. it->slabs_clsid = id;
  102. DEBUG_REFCNT(it, '*');
  103. it->it_flags = settings.use_cas ? ITEM_CAS : 0;
  104. it->nkey = nkey;
  105. it->nbytes = nbytes;
  106. memcpy(ITEM_key(it), key, nkey);
  107. it->exptime = exptime;
  108. memcpy(ITEM_suffix(it), suffix, (size_t)nsuffix);
  109. it->nsuffix = nsuffix;
  110. return it;
  111. }

4.5 do_item_link

形成了一个完成的 item 后, 就要把它放入两个数据结构中, 一是 memcached 的哈希表,

memcached 运行过程中只有一个哈希表, 二是 item 所在的 slabclass 的 LRU 队列.

如 图6 所示, 每个 slabclass 都有一个 LRU 队列

[cpp] view plaincopy
  1. int do_item_link(item *it, const uint32_t hv) {
  2. MEMCACHED_ITEM_LINK(ITEM_key(it), it->nkey, it->nbytes);
  3. assert((it->it_flags & (ITEM_LINKED|ITEM_SLABBED)) == 0);
  4. mutex_lock(&cache_lock);
  5. it->it_flags |= ITEM_LINKED;
  6. it->time = current_time;
  7. STATS_LOCK();
  8. stats.curr_bytes += ITEM_ntotal(it);
  9. stats.curr_items += 1;
  10. stats.total_items += 1;
  11. STATS_UNLOCK();
  12. /* Allocate a new CAS ID on link. */
  13. ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0);
  14. /* 把 item 放入哈希表 */
  15. assoc_insert(it, hv);
  16. /* 把 item 放入 LRU 队列*/
  17. item_link_q(it);
  18. refcount_incr(&it->refcount);
  19. pthread_mutex_unlock(&cache_lock);
  20. return 1;
  21. }

4.6 do_item_unlink

do_item_unlink 与 do_item_unlink 做的工作相反, 把 item 从哈希表和 LRU 队列中删除,

而且还释放掉 item 所占的内存 (其实只是把 item 放到空闲链表中).

[cpp] view plaincopy
  1. void do_item_unlink(item *it, const uint32_t hv) {
  2. MEMCACHED_ITEM_UNLINK(ITEM_key(it), it->nkey, it->nbytes);
  3. mutex_lock(&cache_lock);
  4. if ((it->it_flags & ITEM_LINKED) != 0) {
  5. it->it_flags &= ~ITEM_LINKED;
  6. STATS_LOCK();
  7. stats.curr_bytes -= ITEM_ntotal(it);
  8. stats.curr_items -= 1;
  9. STATS_UNLOCK();
  10. /* 从哈希表中删除 item */
  11. assoc_delete(ITEM_key(it), it->nkey, hv);
  12. /* 从 LRU 队列中删除 item */
  13. item_unlink_q(it);
  14. /* 释放 item 所占的内存 */
  15. do_item_remove(it);
  16. }
  17. pthread_mutex_unlock(&cache_lock);
  18. }

4.7 item_get

根据 key 找对应的 item, 为了加快查找速度, memcached 使用一个哈希表对 key 和 item 所在的内存

地址做映射. item_get 直接从哈希表中查找就可以了, 当然找到了还要检查 item 是否超时. 超时了的 item

将从哈希表和 LRU 队列中删除掉

[cpp] view plaincopy
  1. /** wrapper around assoc_find which does the lazy expiration logic */
  2. item *do_item_get(const char *key, const size_t nkey, const uint32_t hv) {
  3. mutex_lock(&cache_lock);
  4. /* 从哈希表中找 item */
  5. item *it = assoc_find(key, nkey, hv);
  6. if (it != NULL) {
  7. refcount_incr(&it->refcount);
  8. /* Optimization for slab reassignment. prevents popular items from
  9. * jamming in busy wait. Can only do this here to satisfy lock order
  10. * of item_lock, cache_lock, slabs_lock. */
  11. if (slab_rebalance_signal &&
  12. ((void *)it >= slab_rebal.slab_start && (void *)it < slab_rebal.slab_end)) {
  13. do_item_unlink_nolock(it, hv);
  14. do_item_remove(it);
  15. it = NULL;
  16. }
  17. }
  18. pthread_mutex_unlock(&cache_lock);
  19. int was_found = 0;
  20. if (settings.verbose > 2) {
  21. if (it == NULL) {
  22. fprintf(stderr, "> NOT FOUND %s", key);
  23. } else {
  24. fprintf(stderr, "> FOUND KEY %s", ITEM_key(it));
  25. was_found++;
  26. }
  27. }
  28. /* 找到了, 然后检查是否超时 */
  29. if (it != NULL) {
  30. if (settings.oldest_live != 0 && settings.oldest_live <= current_time &&
  31. it->time <= settings.oldest_live) {
  32. do_item_unlink(it, hv);
  33. do_item_remove(it);
  34. it = NULL;
  35. if (was_found) {
  36. fprintf(stderr, " -nuked by flush");
  37. }
  38. } else if (it->exptime != 0 && it->exptime <= current_time) {
  39. do_item_unlink(it, hv);
  40. do_item_remove(it);
  41. it = NULL;
  42. if (was_found) {
  43. fprintf(stderr, " -nuked by expire");
  44. }
  45. } else {
  46. it->it_flags |= ITEM_FETCHED;
  47. DEBUG_REFCNT(it, '+');
  48. }
  49. }
  50. if (settings.verbose > 2)
  51. fprintf(stderr, "\n");
  52. return it;
  53. }

转载于:https://www.cnblogs.com/linguoguo/p/5112539.html

memcache数据组织相关推荐

  1. NoSQL分类及ehcache memcache redis 三大缓存的对比

    NoSQL分类 由于NoSQL中没有像传统数据库那样定义数据的组织方式为关系型的,所以只要内部的数据组织采用了非关系型的方式,就可以称之为NoSQL数据库. 目前,可以将众多的NoSQL数据库按照内部 ...

  2. wdcp php5.3 pdo_mysql,WDCP常用组件(memcache、mysqli、PDO_MYSQL、mysql innodb、libmcrypt、php zip)的安装方法...

    一般来说WDCP安装之后就可以正常使用了,不过对于一些朋友来说还无法满足,现在收集了有关WDCP常用组件,比如memcache.mysqli.PDO_MYSQL.mysql innodb.libmcr ...

  3. Python操作 RabbitMQ、Redis、Memcache、SQLAlchemy

    Memcached Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速度 ...

  4. Memcache内存分配策略

    转自:http://tank.blogs.tkiicpp.com/2010/12/14/memcache%e5%86%85%e5%ad%98%e5%88%86%e9%85%8d%e7%ad%96%e7 ...

  5. memcache和memcached安装

    首先要明确  memcache不是memcached 第一步安装libevent #wget  https://github.com/downloads/libevent/libevent/libev ...

  6. 分享memcache和memcached安装过程

    Memcache是什么? Memcache是一个自由和开放源代码.高性能.分配的内存对象缓存系统.用于加速动态web应用程序,减轻数据库负载. 它可以应对任意多个连接,使用非阻塞的网络IO.由于它的工 ...

  7. Linux下Memcache服务器端的安装

    Linux下Memcache服务器端的安装 服务器端主要是安装memcache服务器端,目前的最新版本是 memcached-1.3.0 . 下载:http://www.danga.com/memca ...

  8. Linux下的Memcache安装(含libevent的安装)

    Linux下Memcache服务器端的安装 服务器端主要是安装memcache服务器端,目前的最新版本是 memcached-1.3.0 . 下载:http://www.danga.com/memca ...

  9. 在apache中使用 memcache 来作 session 存储

    session.save_handler = memcache session.save_path = "tcp://127.0.0.1:11211" 使用多个 memcached ...

最新文章

  1. iOS sql的简单封装
  2. 529. Minesweeper
  3. safari浏览器_吹爆苹果自带浏览器Safari,没有比它更贴心的浏览器了!!
  4. guava_学习_00_资源帖
  5. Java线程的5种状态及切换(透彻讲解)
  6. 统计一个数字在排序数组中出现的次数。
  7. python读取字符串按列分配后按行读出
  8. appium移动自动化测试-安装2
  9. Revit模型轻量化方法
  10. 网站页面篡改及挂马的应急处置
  11. 操作系统——进程调度
  12. CTFshow-萌新
  13. IC验证工具:Ubuntu下Questasim10.7安装(64bit)全攻略
  14. 我的年终奖发了!你呢???
  15. python输入一个英文句子、统计并输出单词数_C语言实现输入多行英文句子然后统计单词数和行数,如何输入?我的代码问题在哪里?...
  16. 全国计算机一级比赛,2017年全国计算机一级考试题及答案
  17. 1万的android手机推荐,Vertu推天价Android手机:入门级售价1万美元
  18. 苹果iOS 13.5越狱unc0ver来了
  19. ssm+jsp计算机毕业设计游戏网站设计n8q96(程序+lw+源码+远程部署)
  20. inpaint-图像修补算法

热门文章

  1. UWB协议:IEEE 802.15.4A‐2011学习
  2. 规划xr871实现儿童故事机的基本功能
  3. 身份证识别SDK——混合非原生调用
  4. python random模块中seed函数的详解_random.seed()函数理解
  5. 使用代理抓取反爬微信文章
  6. 如何旋转图片方法#ps教程#ps学习#ps修图抠图
  7. 外媒:朝鲜导弹发射失败或因美国网络攻击所致
  8. 自定义控件详解(二):Path类 相关用法
  9. linux宿主机ssh访问windows10虚拟机
  10. Express4.X版本修改默认模板jade为ejs并且试用html为视图模板后缀名