简体   繁体   中英

Get list of key-value pairs of APCU

I'm trying to get a list of the key-value stored in APCu.

I have tried apcu_cache_info(), but it doesn't return the value and returns a lot of additional info that I don't need. I don't know if APCUIterator can be the solution, I'm trying to understand the syntax... I have tried the documentation example but nothing happens:

foreach (new APCUIterator('/^counter\./') as $counter) {
    echo "$counter[key]: $counter[value]\n";
    apc_dec($counter['key'], $counter['value']);
}

Some hint?

Thanks for your time.

Try this:

foreach (new APCUIterator('/^\.*/') as $counter)
{
    echo "$counter[key] ---> $counter[value] \n";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM