bp_core_get_incremented_cache_key

Gets the key to be used when caching a value using an incremented cache key.

Description

(string) bp_core_get_incremented_cache_key( (string) $key, (string) $group ); 

The $key is hashed with a component-specific incrementor, which is used to invalidate multiple caches at once.

Returns (string)

Parameters (2)

0. $key (string)
Unique key for the query. Usually a SQL string.
1. $group (string)
Cache group. Eg bp_activity..

Usage

  1. if ( !function_exists( 'bp_core_get_incremented_cache_key' ) ) { 
  2. require_once '/bp-core/bp-core-cache.php'; 
  3.  
  4. // Unique key for the query. Usually a SQL string. 
  5. $key = ''; 
  6.  
  7. // Cache group. Eg 'bp_activity'. 
  8. $group = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_core_get_incremented_cache_key($key, $group); 
  12.  

Defined (1)

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

/bp-core/bp-core-cache.php  
  1. function bp_core_get_incremented_cache_key( $key, $group ) { 
  2. $incrementor = bp_core_get_incrementor( $group ); 
  3. $cache_key = md5( $key . $incrementor ); 
  4. return $cache_key;