_get_non_cached_ids

函式
_get_non_cached_ids ( $object_ids, $cache_key )
引數
  • (int[]) $object_ids Array of IDs.
    Required:
  • (string) $cache_key The cache bucket to check against.
    Required:
返回值
  • (int[]) Array of IDs not present in the cache.
定義位置
相關方法
wp_get_nocache_headersget_nonauthor_user_idsget_cat_idget_all_category_idsget_the_id
引入
3.4.0
棄用
-

_get_non_cached_ids: 這是一個用來獲取所有未被快取的文章或術語的ID的函式。它接受一個分類法或文章型別作為引數,並返回一個ID陣列。

檢索快取中尚未存在的ID。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _get_non_cached_ids( $object_ids, $cache_key ) {
$non_cached_ids = array();
$cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
foreach ( $cache_values as $id => $value ) {
if ( ! $value ) {
$non_cached_ids[] = (int) $id;
}
}
return $non_cached_ids;
}
function _get_non_cached_ids( $object_ids, $cache_key ) { $non_cached_ids = array(); $cache_values = wp_cache_get_multiple( $object_ids, $cache_key ); foreach ( $cache_values as $id => $value ) { if ( ! $value ) { $non_cached_ids[] = (int) $id; } } return $non_cached_ids; }
function _get_non_cached_ids( $object_ids, $cache_key ) {
	$non_cached_ids = array();
	$cache_values   = wp_cache_get_multiple( $object_ids, $cache_key );

	foreach ( $cache_values as $id => $value ) {
		if ( ! $value ) {
			$non_cached_ids[] = (int) $id;
		}
	}

	return $non_cached_ids;
}

常見問題

FAQs
檢視更多 >