get all keys set in memcached

后端 未结 6 2158
执笔经年
执笔经年 2020-12-02 04:43

How can I get all the keys set in my memcached instance(s)?

I tried googling, but didn\'t find much except that PHP supports a getAllKeys method, which

6条回答
  •  执笔经年
    2020-12-02 05:13

    Found a way, thanks to the link here (with the original google group discussion here)

    First, Telnet to your server:

    telnet 127.0.0.1 11211
    

    Next, list the items to get the slab ids:

    stats items
    STAT items:3:number 1
    STAT items:3:age 498
    STAT items:22:number 1
    STAT items:22:age 498
    END
    

    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:

    stats cachedump 3 100
    ITEM views.decorators.cache.cache_header..cc7d9 [6 b; 1256056128 s]
    END
    
    stats cachedump 22 100
    ITEM views.decorators.cache.cache_page..8427e [7736 b; 1256056128 s]
    END
    
    

提交回复
热议问题