大网数据广告活动
PHP 语言与运行手册

wincache_ucache_info · Retrieves information about data stored in the user cache

· 52CE 我爱测

wincache_ucache_info — Retrieves information about data stored in the user cache

wincache_ucache_info

(PECL wincache >= 1.1.0)

wincache_ucache_info — Retrieves information about data stored in the user cache

说明

function wincache_ucache_info(bool $summaryonly = false, string $key = NULL): array|false

Retrieves information about data stored in the user cache.

参数

summaryonly

Controls whether the returned array will contain information about individual cache entries along with the user cache summary.

key

The key of an entry in the user cache. If specified then the returned array will contain information only about that cache entry. If not specified and summaryonly is set to false then the returned array will contain information about all entries in the cache.

返回值

Array of meta data about user cache 或者在失败时返回 false

The array returned by this function contains the following elements:

  • total_cache_uptime - total time in seconds that the user cache has been active

  • total_item_count - total number of elements that are currently in the user cache

  • is_local_cache - true is the cache metadata is for a local cache instance, false if the metadata is for the global cache

  • total_hit_count - number of times the data has been served from the cache

  • total_miss_count - number of times the data has not been found in the cache

  • ucache_entries - an array that contains the information about all the cached items:

    • key_name - name of the key which is used to store the data

    • value_type - type of value stored by the key

    • use_time - time in seconds since the file has been accessed in the opcode cache

    • last_check - time in seconds since the file has been checked for modifications

    • is_session - indicates if the data is a session variable

    • ttl_seconds - time remaining for the data to live in the cache, 0 meaning infinite

    • age_seconds - time elapsed from the time data has been added in the cache

    • hitcount - number of times data has been served from the cache

示例

示例 #1 Using wincache_ucache_info()

<?php
wincache_ucache_get('green');
wincache_ucache_set('green', 2922);
wincache_ucache_get('green');
wincache_ucache_get('green');
wincache_ucache_get('green');
print_r(wincache_ucache_info());
?>

以上示例会输出:

Array 
( ["total_cache_uptime"] => int(0)
  ["is_local_cache"] => bool(false)
  ["total_item_count"] => int(1) 
  ["total_hit_count"] => int(3) 
  ["total_miss_count"] => int(1) 
  ["ucache_entries"] => Array(1) 
    ( [1] => Array(6)
      ( 
        ["key_name"] => string(5) "green"
        ["value_type"] => string(4) "long" 
        ["is_session"] => int(0) 
        ["ttl_seconds"] => int(0)
        ["age_seconds"] => int(0)
        ["hitcount"] => int(3) 
       ) 
    ) 
)

参见

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。