This is an undocumented feature, meaning this command is not supported by the Memcached team, it still exists in 1.4.5 but can possibly be removed in any version.
Telnet command : stats cachedump <slabs_id> <limit>\r\n
Parameters :
- <slabs_id> : slab id from where you want to retreive the keys
- <limit> : result limit, 0 mean no limit
Be aware that this function return is limited to 1MB (or maybe 2MB, this is not clear actually)
Example :
|
1 |
stats cachedump 4 0 |
|
1 2 3 4 5 6 |
ITEM key_7abc8b445c35d211046a856f946dde96a8b48bf8 [172 b; 1293184017 s] ITEM key_da39a3ee5e6b4b0d3255bfef95601890afd80709 [173 b; 1293183894 s] ITEM key_b858a87c07b04c4568f51b0dce655f78d73c02b3 [178 b; 1289314215 s] ITEM key_eadcd9bd2a09c75aef04954e6799e50278ee124a [173 b; 1293186833 s] ITEM key_fa3a0c6f483fb9e1cf9b5d7e4aa224c541dcf618 [167 b; 1289314215 s] END |
It return items with the template
ITEM <item_key> [<item_size> b; <expiration_timestamp> s]
Parameters :
- <item_key> : The item key
- <item_size> : Item size (including key) in bytes
- <expiration_timestamp> : Expiration timestamp in second
To understand the timestamp, we need to make a stats command on the server
|
1 |
stats |
|
1 2 3 4 5 6 |
stats STAT pid 1879 STAT uptime 4222347 STAT time 1293536562 STAT version 1.4.5 [...] |
If the timestamp is equal to stats(time - uptime) then the item have got an infinite expiration else the item will expire when the timestamp is reached.
In our example, 1293536562 - 4222347 = 1289314215, two items have an infinite expiration
You can find a lot of Memcached resources on this Memcached resources page.
Leave a Reply