关于APC和用户数据的问题

发布于 2024-10-26 18:12:57 字数 272 浏览 3 评论 0原文

我从来没有费心去查看我的项目的缓存,因为它们通常很小,最多有一百个用户,而且数据总是在变化。

然后,我考虑尝试 Symfony,它警告我 APC 已被 check_configuration.php 脚本禁用。

我去检查什么是APC,发现它的主要用途是操作码缓存,这很好,但它也有用户数据缓存,当数据库中发生任何更改时,我不确定这是否是我想要的本来就是要被看到的,而且它们每隔几分钟就会发生一次。

谁能解释一下如何禁用此用户数据缓存,或者当数据总是在变化时,APC 是否不应该使用?

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 minutes.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

月寒剑心 2024-11-02 18:12:57

除非您强制,APC 不会缓存任何用户数据。如果 APC 缓存并提供过时的用户数据,那是因为您已将应用程序设计为这样做。除了操作码缓存之外,它只是一个类似于内存缓存的键值存储——它只缓存您显式放入其中的内容。

如果 symfony 有页面缓存行为,您需要在 symfony 中禁用它,而不是 APC。

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.

当梦初醒 2024-11-02 18:12:57

我不使用 APC,而是使用 EAccelerator,但概念是相同的。

操作码缓存通常都很好。

如果您的应用程序不是 RESTful,则内容缓存会很棘手。您需要命名空间和输出之间保持一致的关系,以使缓存有意义。

例如,如果您有一个 RSS 提要,网址为 http://example.com/rss.php 并且内容会定期更改,但 URL 不会更改,缓存比使用 http://example 复杂得多.com/rss.php?time=XXXXXXXXXXUTC

如果您只想防止对使用大量资源且很少更改的 URL 进行 DOS 攻击,您可以为内容缓存设置超时,并接受它或多或少会是最新的。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文