How can i get all items?

Evan Fribourg evan at
Wed Apr 5 17:25:14 UTC 2006

Actually it is possible, although not with one single command.

First I'd issue a "stats slabs", which lists all of the currently allocated
slabs in the format:
STAT (slab_num):(stat_name) (data)

Example output:
STAT 7:chunk_size 128
STAT 7:chunks_per_page 8192
STAT 7:total_pages 1
STAT 7:total_chunks 8192
STAT 7:used_chunks 8164
STAT 7:free_chunks 28
STAT 7:free_chunks_end 8164
STAT 8:chunk_size 256
STAT 8:chunks_per_page 4096
STAT 8:total_pages 1
STAT 8:total_chunks 4096
STAT 8:used_chunks 4095
STAT 8:free_chunks 1
STAT 8:free_chunks_end 4095

Then, with some programming, it is possible to parse out and get a list of
unique slabs that are in use.

Then, for each slab, you can issue "stats cachedump (slab_num)" which
returns item keys in the format:
ITEM (key) [(size) b; (timestamp) s]

Example output:
ITEM b00a31dfc29cdf6d3207cbcb81d29fe0 [2756 b; 1144257378 s]
ITEM a40fb247233320619da2d742e691774b [3329 b; 1144257375 s]
ITEM fea811327b1ed962aaeecdc87d759fc0 [3334 b; 1144257362 s]
ITEM 910c35ef914bd45b44b0f1148e3e8c34 [3540 b; 1144257347 s]
ITEM 1115ac936267339093b53d11e9c16075 [2673 b; 1144257128 s]

Based on reviewing the code, however, there is a limit to the size of the
output buffer -- so if you have so many keys that the size of the output
exceeds the ouput buffer, then you won't be able to retrieve all keys for
that slab -- output would be truncated.



-----Original Message-----
From: memcached-bounces at
[mailto:memcached-bounces at] On Behalf Of Brad Fitzpatrick
Sent: Wednesday, April 05, 2006 12:54 AM
To: csepinek at
Cc: memcached at
Subject: Re: How can i get all items?


On Wed, 5 Apr 2006 csepinek at wrote:

> Hi all!
> Could someone tell me, how can i get all cached items? For example I 
> wanna get all key.
> Thanks before...
> --
> Best regards,
>  csepinek                          mailto:csepinek at

More information about the memcached mailing list