apcu_cache_info
(PECL apcu >= 4.0.0)
apcu_cache_info — 從 APCu 儲存中獲取快取資訊
說明
apcu_cache_info(bool
$limited
= false
): array|false從 APCu 儲存中獲取快取資訊和後設資料(meta-data)。
參數
-
limited
-
如果
limited
為true
,則不會返回具體被快取的數據的列表,這在嘗試根據統計數據進行呼叫優化時是很有用的。
返回值
成功時返回包含快取數據(和後設資料)的陣列 或者在失敗時返回 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