apcu_cache_info
(PECL apcu >= 4.0.0)
apcu_cache_info — 从 APCu 存储中获取缓存信息
返回值
成功时返回包含缓存数据(和元数据)的数组 或者在失败时返回 false
注意: 当 apcu_cache_info() 无法获取到缓存信息时会触发警告(warning),这种情况通常是因为没有开启 APC 功能。
更新日志
| 版本 | 说明 |
|---|---|
| PECL apcu 3.0.11 |
引入了 limited 参数。
|
| PECL apcu 3.0.16 |
为 cache_type 参数增加了 "filehits" 选项。
|
示例
示例 #1 apcu_cache_info() 示例
<?php
print_r(apcu_cache_info());
?>以上示例的输出类似于:
Array
(
[num_slots] => 2000
[ttl] => 0
[num_hits] => 9
[num_misses] => 3
[start_time] => 1123958803
[cache_list] => Array
(
[0] => Array
(
[filename] => /path/to/apcu_test.php
[device] => 29954
[inode] => 1130511
[type] => file
[num_hits] => 1
[mtime] => 1123960686
[creation_time] => 1123960696
[deletion_time] => 0
[access_time] => 1123962864
[ref_count] => 1
[mem_size] => 677
)
[1] => Array (...依次列出每个缓存文件)
)
参见
- APCu 配置指令
- APCUIterator::getTotalSize() - Get total cache size
- APCUIterator::getTotalHits() - Get total cache hits
- APCUIterator::getTotalCount() - Get total count
+添加备注
用户贡献的备注 1 note
RQuadling at GMail dot com ¶
2 years ago
If you get the following warning when using APCu functions via PHP's CLI SAPI:
PHP Warning: apcu_cache_info(): No APC info available. Perhaps APC is not enabled? Check apc.enabled in your ini file
then check the status of `apc.enable_cli`. This is a separate INI entry for enabling APC via the CLI SAPI.备份地址:http://www.lvesu.com/blog/php/function.apcu-cache-info.php