Search code examples
phpapc

APCIterator empty


I have enabled APC in php.ini, and looking at phpinfo(), it all seems ok. I also have apc.enable_cli=1 directive in php.ini. I've stored several keys that start with raw_ prefix and they get stored (apc_store() returns true, apc_fetch() returns the value for that key.

All ok so far.

So I wanted to use APCIterator to fetch all keys that start with raw_, using this statement:

$iterator = new APCIterator("user", '/^raw_\.*/');

A key looks like this:

raw_2014-04-17 12:19:00_0.68206200 1397726355534f9c93a68649.18047787158329

It seems that if I print_r($iterator) or iterate it using foreach(), it is empty.

Any ideas what can be wrong?

Thank you!


Solution

  • Actually the problem was this: How can I get PHP to use the same APC cache when invoked on the CLI and the web?

    I used CLI mode to fetch from APC and used store() via HTTP request. APC does not share data between Apache and CLI