为什么我的所有文件都没有使用 apc 操作代码进行缓存?
我正在使用 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截图
正在进行 opcached 的文件
以及我需要文件并在 Zend_Loader_Autoloader 中注册自动加载器的 index.php (ZF)。
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
The files that are getting opcached
And the index.php (ZF) where I require files and register autoloader within Zend_Loader_Autoloader.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
自动加载的最大缺点之一可能是 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?
由于某些原因 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.