Hello,

2011/4/7 Bluntcoder <[email protected]>:
> Hello,
>
> I'm trying to write a tool that will show all the data inside
> memcached, including expiry times of the keys. However I have run into

Well, I make a tool for the same purpose as well (
http://www.cnblogs.com/sunyongyue/archive/2011/04/01/memcached_key_traversal.html
), but then found the fact that 'stats cachedump' has a limit echo
buffer memory up to 2MB and won't  be able to return all items if
there is too many.

> that were collected, and the fact the difference keeps on growing, I
> am left to assume that the number in cache dump is *not* the expiry
> time, but the time that the key was set.

That base on the version you have, see the source code below.
typedef struct _stritem {
……
    rel_time_t      time;       /* least recent access */
    rel_time_t      exptime;    /* expire time */
……
} item;

// in 1.2.1, use 'least recent access'
        len = sprintf(temp, "ITEM %s [%u b; %lu s]\r\n", ITEM_key(it),
it->nbytes - 2, it->time + stats.started);

// in 1.4.5, use 'expire time'
        len = snprintf(temp, sizeof(temp), "ITEM %s [%d b; %lu s]\r\n",
                       key_temp, it->nbytes - 2,
                       (unsigned long)it->exptime + process_started);
best regards
--
Abioy

Reply via email to