开发者

PHP APC failing in unit tests

We use the APC user cache in our application, but I've started noticing various problems in our unit tests specifically related to the APC tests.

It seems that eventually APC starts failing to store and retrieve results; while most of the tests continue to run correctly (as they just rebuild data if it's not recovered from the cache) the tests that specifically test that caches are emptied or repopulated when they should be fail, which is somewhat annoying. The same tests run开发者_高级运维 fine if they are ran in isolation, rather than as part of the whole test suite).

Questions

  • Has anyone else had similar problems? I can't seem to find much on this through google, aside from problems with the slam_defence setting breaking unit tests (which doesn't seem to be my problem, as it doesn't display any error messages for me).
  • Does anyone know how to get more debugging info out of APC? I detect failure by checking the return code of apc_store() and passing the extra success parameter to apc_fetch(), but all I get from that is a boolean success/failure status; no details on which I can follow up on.


My guess would be that perhaps the cache is full. In your application this is something you should be able to handle (never assume the items exist in cache). I'm not aware of how APC caches or expires stuff, so it is weird that 'later stuff' isn't retained.

In the case of your unittests, would calling apc_clear_cache('user') for every test work?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜