PHP中有没有缓存代码的机制?

发布于 2025-01-08 15:47:31 字数 147 浏览 3 评论 0原文

最近,我一直在阅读 Passenger/Rails 中的 Rack 架构,以及它如何通过在服务器启动时缓存代码或类来提高每个请求的速度并降低内存使用量。

PHP 有类似的东西吗?将代码(而不是数据)保存在内存中的东西,因此应用程序不需要每次都读取使用的每个文件。

Lately I have been reading about the Rack architecture in Passenger/Rails, and how it brings speed and lower memory usage for each request, by caching the code or classes when the server starts.

Is there anything similar for PHP? Something that keeps the code (not data) in memory, so the application don't need to read each file used every time.

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

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

发布评论

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

评论(3

如梦亦如幻 2025-01-15 15:47:31

您想要的称为操作码缓存。有几个:

What you want is called an opcode cache. There are several:

风月客 2025-01-15 15:47:31

替代 PHP 缓存 (APC) 是一个免费且开放的 PHP 操作码缓存。其目标是提供一个免费、开放且健壮的框架来缓存和优化 PHP 中间代码。

此链接将有所帮助: http://www.php.net/manual/en/书.apc.php

The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.

this link will help: http://www.php.net/manual/en/book.apc.php

栩栩如生 2025-01-15 15:47:31

APC - http://www.php.net/manual/en/intro.apc .php 可能就是您正在寻找的。还有其他的 - xcache & eacclerator,但我相信 APC 是使用最广泛的,并且我相信它将成为 PHP 大约版本 6 的一部分。

APC - http://www.php.net/manual/en/intro.apc.php is probably what you are looking for. There are others as well - xcache & eacclerator, but my belief is that APC is the most widely used and I believe it is going to become part of PHP circa version 6.

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