php apc_fetch all ids
Asked Answered
R

4

9

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 *

Ramonitaramos answered 29/5, 2012 at 11:42 Comment(0)
C
13

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'];
}
Communistic answered 29/5, 2012 at 11:47 Comment(2)
Yes sir, with this code I get the keys... which is more than enough to see what I'm caching in my appRamonitaramos
When doing this i get " Allowed memory size of 134217728 bytes exhausted" also backtrace shows that the rewind() method is to blame. My regex matches exactly 1 entry in APC. Any idea how to fix this?Laurenelaurens
O
2

apc_cache_info() might be what you're looking for

Organza answered 29/5, 2012 at 11:48 Comment(1)
ok, this isn't exactly what I am looking for. This doesn't retrieve the cached data. But thanks any wayRamonitaramos
C
1

The APCIterator class might be what you are looking for.

Cursorial answered 29/5, 2012 at 11:45 Comment(0)
B
-2

APC extension is not installed on your APache.

so download a APc based on your PHP version and install it.

http://downloads.php.net/pierre/

if you need installation tuts. read it here.

http://kvcodes.com/2014/06/solution-call-undefined-function-apc_fetch/

Bungalow answered 9/6, 2014 at 5:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.