List keys stored in memcached / Amazon AWS ElastiCache server

Posted Almost 11 years ago. Visible to the public.

Connect to your memcached host. (AWS elasticache is memcached)

telnet foohost23.cs2631.0001.euw1.cache.amazonaws.com 11211 

Once you're connected, find out which 'slabs' exist within the cache:

stats items
STAT items:1:number 3550
STAT items:1:age 5166393
STAT items:1:evicted 0
STAT items:1:evicted_nonzero 0
STAT items:1:evicted_time 0
STAT items:1:outofmemory 0
STAT items:1:tailrepairs 0
STAT items:1:reclaimed 0
STAT items:2:number 144886
STAT items:2:age 1375536
STAT items:2:evicted 0
STAT items:2:evicted_nonzero 0
STAT items:2:evicted_time 0
STAT items:2:outofmemory 0
STAT items:2:tailrepairs 0
STAT items:2:reclaimed 1638
STAT items:3:number 2628952
STAT items:3:age 232524
STAT items:3:evicted 0
STAT items:3:evicted_nonzero 0
STAT items:3:evicted_time 0
STAT items:3:outofmemory 0
STAT items:3:tailrepairs 0
STAT items:3:reclaimed 151110
...

The number after items: shows the respective slab.
You can retrieve the keys stored within this container using stats cachedump <slab> <limit>:

stats cachedump 1 5
ITEM foo100:Class|last_id [6 b; 1342195946 s]
ITEM foo106:Class|last_id [7 b; 1342195946 s]
ITEM foo:Class|last_id [7 b; 1342195946 s]
ITEM foo106:Class|lock [9 b; 1373030893 s]
ITEM foo100:Class|lock [8 b; 1373030581 s]
Thomas Eisenbarth
Keywords
amazon, web, services
License
Source code in this card is licensed under the MIT License.
Posted by Thomas Eisenbarth to makandra dev (2013-07-05 12:41)