_get_non_cached_ids

The timeline below displays how wordpress function _get_non_cached_ids has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Retrieves IDs that are not already present in the cache.
 *
 * @since 3.4.0
 * @since 6.1.0 This function is no longer marked as "private".
 *
 * @param int[]  $object_ids  Array of IDs.
 * @param string $cache_group The cache group to check against.
 * @return int[] Array of IDs not present in the cache.
 */
function _get_non_cached_ids($object_ids, $cache_group)
{
    $object_ids = array_filter($object_ids, '_validate_cache_id');
    $object_ids = array_unique(array_map('intval', $object_ids), SORT_NUMERIC);
    if (empty($object_ids)) {
        return array();
    }
    $non_cached_ids = array();
    $cache_values = wp_cache_get_multiple($object_ids, $cache_group);
    foreach ($cache_values as $id => $value) {
        if (false === $value) {
            $non_cached_ids[] = (int) $id;
        }
    }
    return $non_cached_ids;
}

WordPress Version: 6.3

/**
 * Retrieves IDs that are not already present in the cache.
 *
 * @since 3.4.0
 * @since 6.1.0 This function is no longer marked as "private".
 *
 * @param int[]  $object_ids  Array of IDs.
 * @param string $cache_group The cache group to check against.
 * @return int[] Array of IDs not present in the cache.
 */
function _get_non_cached_ids($object_ids, $cache_group)
{
    $object_ids = array_filter($object_ids, '_validate_cache_id');
    $object_ids = array_unique(array_map('intval', $object_ids), SORT_NUMERIC);
    if (empty($object_ids)) {
        return array();
    }
    $non_cached_ids = array();
    $cache_values = wp_cache_get_multiple($object_ids, $cache_group);
    foreach ($cache_values as $id => $value) {
        if (!$value) {
            $non_cached_ids[] = (int) $id;
        }
    }
    return $non_cached_ids;
}

WordPress Version: 6.1

/**
 * Retrieves IDs that are not already present in the cache.
 *
 * @since 3.4.0
 * @since 6.1.0 This function is no longer marked as "private".
 *
 * @param int[]  $object_ids Array of IDs.
 * @param string $cache_key  The cache bucket to check against.
 * @return int[] Array of IDs not present in the cache.
 */
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;
}

WordPress Version: 5.5

/**
 * Retrieve IDs that are not already present in the cache.
 *
 * @since 3.4.0
 * @access private
 *
 * @param int[]  $object_ids Array of IDs.
 * @param string $cache_key  The cache bucket to check against.
 * @return int[] Array of IDs not present in the cache.
 */
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;
}

WordPress Version: 5.1

/**
 * Retrieve IDs that are not already present in the cache.
 *
 * @since 3.4.0
 * @access private
 *
 * @param int[]  $object_ids Array of IDs.
 * @param string $cache_key  The cache bucket to check against.
 * @return int[] Array of IDs not present in the cache.
 */
function _get_non_cached_ids($object_ids, $cache_key)
{
    $clean = array();
    foreach ($object_ids as $id) {
        $id = (int) $id;
        if (!wp_cache_get($id, $cache_key)) {
            $clean[] = $id;
        }
    }
    return $clean;
}

WordPress Version: 4.0

/**
 * Retrieve ids that are not already present in the cache.
 *
 * @since 3.4.0
 * @access private
 *
 * @param array  $object_ids ID list.
 * @param string $cache_key  The cache bucket to check against.
 *
 * @return array List of ids not present in the cache.
 */
function _get_non_cached_ids($object_ids, $cache_key)
{
    $clean = array();
    foreach ($object_ids as $id) {
        $id = (int) $id;
        if (!wp_cache_get($id, $cache_key)) {
            $clean[] = $id;
        }
    }
    return $clean;
}

WordPress Version: 3.7

/**
 * Retrieve ids that are not already present in the cache
 *
 * @since 3.4.0
 *
 * @param array $object_ids ID list
 * @param string $cache_key The cache bucket to check against
 *
 * @return array
 */
function _get_non_cached_ids($object_ids, $cache_key)
{
    $clean = array();
    foreach ($object_ids as $id) {
        $id = (int) $id;
        if (!wp_cache_get($id, $cache_key)) {
            $clean[] = $id;
        }
    }
    return $clean;
}