天天看点

Memcache 查看列出所有key的方法

一个不错的列出memcache中所有key的方法,在某些场景下非常有用:

Telnet to your server:

List the items, to get the slab ids:

<code>stats items</code>

<code>STAT items:3:number 1</code>

<code>STAT items:3:age 498</code>

<code>STAT items:22:number 1</code>

<code>STAT items:22:age 498</code>

<code>END</code>

<code></code>

The first number after ‘items’ is the slab id. Request a cache dump for each slab id, with a limit for the max number of keys to dump:

<code>stats cachedump 3 100</code>

<code>ITEM views.decorators.cache.cache_header..cc7d9 [6 b; 1256056128 s]</code>

<code>stats cachedump 22 100</code>

<code>ITEM views.decorators.cache.cache_page..8427e [7736 b; 1256056128 s]</code>

There you go!

原文:http://www.darkcoding.net/software/memcached-list-all-keys/

本文转自 古道卿 51CTO博客,原文链接:http://blog.51cto.com/gudaoqing/1400114