Héctor
Héctor

Reputation: 419

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.

Upvotes: 0

Views: 1368

Answers (1)

karrtojal
karrtojal

Reputation: 886

Try this:

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

Upvotes: 0

Related Questions