_get_non_cached_ids()
Retrieves IDs that are not already present in the cache.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Return
Int[]
. Array of IDs not present in the cache.
Usage
_get_non_cached_ids( $object_ids, $cache_group );
- $object_ids(int[]) (required)
- Array of IDs.
- $cache_group(string) (required)
- The cache group to check against.
Changelog
Since 3.4.0 | Introduced. |
Since 6.1.0 | This function is no longer marked as "private". |
_get_non_cached_ids() get non cached ids code WP 6.4.3
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; }