APC虽然启用但未获取 - 未显示错误

时间:2014-02-06 20:00:24

标签: php apc

我在我的网站上安装并启用了APC。我写了一个小缓存脚本并在我的开发环境中测试它并且它工作。当我将它移动到我们的生产服务器时,它不是缓存,但它也没有抛出任何错误。我写了一个新的测试脚本来检查发生了什么,一切看起来都正确。这是我的测试脚本:

//Do menu caching
$apc_fetch_status = false;
$dropdownmenu = apc_fetch('test',$apc_fetch_status);

print "<pre>";
print_r(apc_cache_info());
print "</pre>";

if (!$apc_fetch_status) {
    $dropdownmenu    = new stdClass();
    apc_store('test',$dropdownmenu,900);
    echo "no cache";
}else {
    echo "Cached!";
}

echo phpinfo();

当我运行此脚本时,我为apc_cache_info显示以下内容:

Array
(
    [num_slots] => 10243
    [ttl] => 0
    [num_hits] => 0
    [num_misses] => 1
    [num_inserts] => 1
    [expunges] => 0
    [start_time] => 1391716030
    [mem_size] => 4240
    [num_entries] => 1
    [file_upload_progress] => 1
    [memory_type] => mmap
    [locking_type] => pthread read/write Locks
    [cache_list] => Array
        (
            [0] => Array
                (
                    [type] => file
                    [device] => 0
                    [inode] => 0
                    [filename] => /home/xxx/public_html/test.php
                    [num_hits] => 0
                    [mtime] => 1391715986
                    [creation_time] => 1391716031
                    [deletion_time] => 0
                    [access_time] => 1391716031
                    [ref_count] => 0
                    [mem_size] => 4240
                )
        )
    [deleted_list] => Array
        (
        )
    [slot_distribution] => Array
        (
            [1154] => 1
        )
)

以下是phpinfo关于APC的说法:

PHP Info

当我运行这个脚本时,每次运行都会得到“无缓存”,这表明它没有取出我的对象。

任何人都可以在我的设置中看到任何可能导致提取失败的内容吗?

感谢您的帮助。

0 个答案:

没有答案