_bb_get_cached_data

The BuddyPress bb get cached data function.

Description

_bb_get_cached_data( $keys, $group, $callback ); 

Parameters (3)

0. $keys
The keys.
1. $group
The group.
2. $callback
The callback.

Usage

  1. if ( !function_exists( '_bb_get_cached_data' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-forums.php'; 
  3.  
  4. // The keys. 
  5. $keys = null; 
  6.  
  7. // The group. 
  8. $group = null; 
  9.  
  10. // The callback. 
  11. $callback = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = _bb_get_cached_data($keys, $group, $callback); 
  15.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-forums.php  
  1. function _bb_get_cached_data( $keys, $group, $callback ) { 
  2. $return = array(); 
  3. foreach ( $keys as $key ) { 
  4. // should use wp_cache_get_multi if available 
  5. if ( false === $value = wp_cache_get( $key, $group ) ) { 
  6. if ( !$value = call_user_func( $callback, $key ) ) { 
  7. continue; 
  8. $return[$key] = $value; 
  9. return $return;