为什么我的所有文件都没有使用 apc 操作代码进行缓存?

发布于 2024-12-21 14:37:57 字数 1286 浏览 2 评论 0原文

我正在使用 APC (3.1.9) 和 Zend Framework,但是,只有一堆文件被缓存(大约 10 / 400)。

你有什么想法吗?我在 Debian 安装中使用工厂选项。

编辑:看起来唯一被 opcached 的文件是我用 require ''; 手动调用的文件,但是由我的自动加载器加载的文件不是。有什么想法吗?


运行时设置

apc.cache_by_default    1
apc.canonicalize    1
apc.coredump_unmap  0
apc.enable_cli  0
apc.enabled 1
apc.file_md5    0
apc.file_update_protection  2
apc.filters 
apc.gc_ttl  3600
apc.include_once_override   0
apc.lazy_classes    0
apc.lazy_functions  0
apc.max_file_size   1M
apc.mmap_file_mask  
apc.num_files_hint  1000
apc.preload_path    
apc.report_autofilter   1
apc.rfc1867 0
apc.rfc1867_freq    0
apc.rfc1867_name    APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_
apc.rfc1867_ttl 3600
apc.serializer  default
apc.shm_segments    1
apc.shm_size    32M
apc.slam_defense    1
apc.stat    1
apc.stat_ctime  0
apc.ttl 0
apc.use_request_time    1
apc.user_entries_hint   4096
apc.user_ttl    0
apc.write_lock  1

这里是apc.php截图 apc.php

正在进行 opcached 的文件 php code

以及我需要文件并在 Zend_Loader_Autoloader 中注册自动加载器的 index.php (ZF)。

opcached 文件

I'm using APC (3.1.9) and Zend Framework, however, only a bunch of file are being cached (something like 10 / 400).

Do you have any ideas? I'm using the factory options on a debian installation.

EDIT: It looks like the only file which are opcached are the one I manually call with require ''; however the ones which are loaded by my autoloader are not. Any ideas?


Runtime Settings

apc.cache_by_default    1
apc.canonicalize    1
apc.coredump_unmap  0
apc.enable_cli  0
apc.enabled 1
apc.file_md5    0
apc.file_update_protection  2
apc.filters 
apc.gc_ttl  3600
apc.include_once_override   0
apc.lazy_classes    0
apc.lazy_functions  0
apc.max_file_size   1M
apc.mmap_file_mask  
apc.num_files_hint  1000
apc.preload_path    
apc.report_autofilter   1
apc.rfc1867 0
apc.rfc1867_freq    0
apc.rfc1867_name    APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_
apc.rfc1867_ttl 3600
apc.serializer  default
apc.shm_segments    1
apc.shm_size    32M
apc.slam_defense    1
apc.stat    1
apc.stat_ctime  0
apc.ttl 0
apc.use_request_time    1
apc.user_entries_hint   4096
apc.user_ttl    0
apc.write_lock  1

here is apc.php screenshots
apc.php

The files that are getting opcached
php code

And the index.php (ZF) where I require files and register autoloader within Zend_Loader_Autoloader.

opcached files

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

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

发布评论

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

评论(2

想你只要分分秒秒 2024-12-28 14:37:57

自动加载的最大缺点之一可能是 op 缓存不会像人们希望的那样缓存自动加载的文件(自动加载是运行时,而 include/require 是编译时。或者不是。我不声称理解它。)。点击此处了解更多信息。

虽然我从未尝试过,但我想知道通过在自动加载器中调用 apc_compile_file() 手动将自动加载的文件添加到缓存中是否可以有效解决此问题?

Probably one of the biggest downside to autoloading is that op cache doesn't cache autoloaded files as one would hope (something about autoload being runtime vs. include/require being compile time. Or not. I dont claim to understand it.). Read more here.

While I never tried, I wonder if manually adding your autoloaded file to the cache by calling apc_compile_file() in the autoloader would, effectively, solve this issue?

糖果控 2024-12-28 14:37:57

由于某些原因 apc.cache_by_default 设置为 OFF,我的文件没有正确缓存,考虑到此配置,这是合乎逻辑的,但是,我仍然不明白为什么我手动需要的文件实际上被缓存了。

For some reasons apc.cache_by_default was set to OFF, an my files were not getting cached correctly, which is logical given this config, however, I still don't understand why those I manually required was actually cached.

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