bp_core_get_incrementor

Gets a group-specific cache incrementor.

Description

(string) bp_core_get_incrementor( (string) $group ); 

The incrementor is paired with query identifiers (like SQL strings) to create cache keys that can be invalidated en masse.

If an incrementor does not yet exist for the given $group,, one will be created.

Returns (string)

Parameters (1)

0. $group (string)
Cache group. Eg bp_activity..

Usage

  1. if ( !function_exists( 'bp_core_get_incrementor' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-cache.php'; 
  3.  
  4. // Cache group. Eg 'bp_activity'. 
  5. $group = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_get_incrementor($group); 
  9.  

Defined (1)

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

/bp-core/bp-core-cache.php  
  1. function bp_core_get_incrementor( $group ) { 
  2. $incrementor = wp_cache_get( 'incrementor', $group ); 
  3. if ( ! $incrementor ) { 
  4. $incrementor = microtime(); 
  5. wp_cache_set( 'incrementor', $incrementor, $group ); 
  6.  
  7. return $incrementor;