Read more

List keys stored in memcached / Amazon AWS ElastiCache server

Thomas Eisenbarth
July 05, 2013Software engineer at makandra GmbH

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

telnet foohost23.cs2631.0001.euw1.cache.amazonaws.com 11211 
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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]
Posted by Thomas Eisenbarth to makandra dev (2013-07-05 14:41)