Search code examples
phpcachingapcoutputcache

php apc_fetch all ids


Is there a way to fetch and print, all the data stored in apc's storage?

I need to do so for testing and debugging purposes.

I know I can retrieve a specific data by doing apc_fetch(id), but I don't know any way to retrieve all the data by passing (as an example) a *


Solution

  • Yes, you can get this with APCIterator. This allows you to loop through all the items stored with APC.

    $iter = new APCIterator('user');
    foreach ($iter as $item) {
        echo $item['key'] . ': ' . $item['value'];
    }