开发者

Question about APC and user data

I have never bothered to look at caching for my projects, because they´re usually small, with a hundred users at most, and the data is always changing.

Then, I thought about trying Symfony and it warned me that APC was disabled with the check_configuration.php script.

I went to check what is APC, and saw that it´s main use is opcode caching, which is good, bu that it also has user data caching, which I´m not sure is something I want when any changes in the database are meant to be seen, and they happen every couple of min开发者_JS百科utes.

Could anyone explain how do I disable this user data cache, or is APC something not to be used when data is always changing?


APC doesn't cache any user data unless you force it to. If APC caches and serves stale user data, that's because you've designed your application to do so. Outside of opcode caching, it's just a key-value store somewhat comparable to memcache -- it only caches what you explicitly put in it.

If symfony has page caching behavior, you need to disable that in symfony, not APC.


I don't use APC, I use EAccelerator instead, but the concepts are the same.

Opcode caches are generally good.

Content caching is tricky if your application isn't RESTful. You need a consistent relationship between your namespaces and your output to make caching meaningful.

For example if you have an RSS feed at an url http://example.com/rss.php and the content changes regularly without the URL changing, caching is much more complex than if you used http://example.com/rss.php?time=XXXXXXXXXXUTC

If all you want to do is prevent DOS attacks on an URL which uses a lot of resources and changes rarely you can set a timeout for the content cache, and accept that it will be more-or-less up to date.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜