php - 为什么我的所有文件都没有缓存 apc 操作码?

标签 php caching 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的截图 apc.php

被缓存的文件 php code

还有我在 Zend_Loader_Autoloader 中需要文件和注册自动加载器的 index.php (ZF)。

opcached files

最佳答案

可能自动加载的最大缺点之一是操作缓存不会像人们希望的那样缓存自动加载的文件(关于自动加载是运行时与 include/require 是编译时的事情。或者不是。我不声称理解它。 ).阅读更多 here .

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

关于php - 为什么我的所有文件都没有缓存 apc 操作码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8545656/

相关文章:

php - APC __PHP_Incomplete_Class_Name

php 超时 - set_time_limit(0); - 不工作

http - 浏览器是否会根据协议(protocol)改变缓存内容?

php - Controller::detect() 在 Laravel 4 中未定义

java - Guava 缓存的预加载值

asp.net - 缓存常见查找数据 - 策略

php - APC 在哪里存储它的操作码和用户变量缓存?

PHP apc/apcu 缓存不保留中间结果而 shmop 保留,为什么?

php - 为什么 php 无法与本地 sql 数据库对话?

php - Laravel:如何通过 post 获取数据