I read this - How does the lazy expiration mechanism in memcached operate?
So I have a question. Is it possible/recommended to make a program myself that periodically checks for all items in memcached, sending GET requests for each item so that expired items are removed?
The reason I want this is because I want to have a proper control of the used percentage in Memcached. If that percentage is near 100%, I will never be sure if I should add more memory, or if I should not worry because there are many expired items.
I use PHP, and unfortunately this doesn't return all the items in memcached (no clue why):
$allSlabs = $memcache->getExtendedStats('slabs');
foreach ($allSlabs as $server => $slabs) {
foreach ($slabs as $slabId => $slabMeta) {
$cdump = $memcache->getExtendedStats('cachedump', (int)$slabId);
foreach ($cdump as $keys => $arrVal) {
foreach ($arrVal as $key => $v) {
echo $key, "\n";
}
}
}
}