We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

CLI APC not caching table schema

Hi We managed to get APC working for a system we built in phalcon but we also have crons running as cli tasks. And these tasks dont seem to save the meta data with apc. They keep running queries like this: SELECT IF(COUNT(*)>0, 1 , 0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='TABLENAME'; Does anyone know how to fix this? The apc is enabled in the cli php.ini. Thanx



98.9k

What version are you using?



5.1k

Hi We are using version 1.3



98.9k

Have you checked if apc_store/apc_fetch are working fine under CLI?



846

the response shows the test variable in the browser via a normal controller.

however the cli just returns empty value.



5.1k
edited Sep '14

As my colleague above mentions the apc_fetch was returning empty. I have since made sure the cli.php had apc.enable_cli on which it does now. Now it does return the apt_fetch but the crons still return the same queries in my mysql log SELECT IF(COUNT(*)>0, 1 , 0) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='TABLENAME'; one for each cron thread.



98.9k

That's how APC works in CLI, it creates a new memory pool for every process created which could be a very unexpected behavior: https://stackoverflow.com/a/10423978/1022921



5.1k

I guess to some extent that does make sense, thanx. It still means that all these table metadata queries are seen as un-indexed queries and gets logged 100 times per minute. However, am I not correct in saying that even without APC phalcon will still run these queries each time my threads run?