bp_get_non_cached_ids

Determine which items from a list do not have cached values.

Description

(array) bp_get_non_cached_ids( (array) $item_ids, (string) $cache_group ); 

Returns (array)

Parameters (2)

0. $item_ids (array)
The item ids.
1. $cache_group (string)
The cache group to check against.

Usage

  1. if ( !function_exists( 'bp_get_non_cached_ids' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-cache.php'; 
  3.  
  4. // The item ids. 
  5. $item_ids = array(); 
  6.  
  7. // The cache group to check against. 
  8. $cache_group = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_get_non_cached_ids($item_ids, $cache_group); 
  12.  

Defined (1)

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

/bp-core/bp-core-cache.php  
  1. function bp_get_non_cached_ids( $item_ids, $cache_group ) { 
  2. $uncached = array(); 
  3.  
  4. foreach ( $item_ids as $item_id ) { 
  5. $item_id = (int) $item_id; 
  6. if ( false === wp_cache_get( $item_id, $cache_group ) ) { 
  7. $uncached[] = $item_id; 
  8.  
  9. return $uncached;