WP CLI说明文档

wp cache supports

命令概述

用于检查指定的缓存特性是否被支持,常用于脚本中判断缓存后端能力。

适合在需要验证缓存功能可用性时使用,如检查是否支持 add_multiple 等特性。

参数列表

参数 说明
<feature> 要检查的特性名称。

常用示例

检查 add_multiple 是否被支持

$ wp cache supports add_multiple
$ echo $?
0

在 Bash 脚本中检查支持情况

if ! wp cache supports non_existing; then
    echo 'non_existing is not supported'
fi