_get_non_cached_ids

Retrieve ids that are not already present in the cache.

Description

(array) _get_non_cached_ids( (array) $object_ids, (string) $cache_key ); 

Returns (array)

List of ids not present in the cache.

Parameters (2)

0. $object_ids (array)
The object ids.
1. $cache_key (string)
The cache bucket to check against.

Usage

  1. if ( !function_exists( '_get_non_cached_ids' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // The object ids. 
  5. $object_ids = array(); 
  6.  
  7. // The cache bucket to check against. 
  8. $cache_key = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _get_non_cached_ids($object_ids, $cache_key); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function _get_non_cached_ids( $object_ids, $cache_key ) { 
  2. $clean = array(); 
  3. foreach ( $object_ids as $id ) { 
  4. $id = (int) $id; 
  5. if ( !wp_cache_get( $id, $cache_key ) ) { 
  6. $clean[] = $id; 
  7.  
  8. return $clean;