按键和组从缓存中检索缓存内容。
原型
wp_cache_get( int|string $key, string $group = '', bool $force = false, bool $found = null )
参数
$key
(int|string)
(Required)
存储缓存内容的密钥。
$group
(string)
(Optional)
缓存内容分组的位置。
$force
(bool)
(Optional)
是否强制从持久高速缓存更新本地高速缓存。
$found
(bool)
(Optional)
密钥是否在缓存中找到(通过引用传递)。消除虚假,可存储价值的回报。
返回值
(bool|mixed)
如果在成功时无法检索内容或缓存内容,则为false
源文件
路径:wp-includes/cache.php
<?php
...
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
global $wp_object_cache;
return $wp_object_cache->get( $key, $group, $force, $found );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_cache_get/