wp_cache_incr

Increment numeric cache item's value.

Description

(false|int) wp_cache_incr( (int|string) $key, (int) $offset = 1, (string) $group = '' ); 

Returns (false|int)

False on failure, the item's new value on success.

Parameters (3)

0. $key (int|string)
The key for the cache contents that should be incremented.
1. $offset — Optional. (int) => 1
The amount by which to increment the item's value. Default 1.
2. $group — Optional. (string) => ''
The group the key is in. Default empty.

Usage

  1. if ( !function_exists( 'wp_cache_incr' ) ) { 
  2. require_once ABSPATH . WPINC . '/cache.php'; 
  3.  
  4. // The key for the cache contents that should be incremented. 
  5. $key = null; 
  6.  
  7. // Optional. The amount by which to increment the item's value. Default 1. 
  8. $offset = 1; 
  9.  
  10. // Optional. The group the key is in. Default empty. 
  11. $group = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = wp_cache_incr($key, $offset, $group); 
  15.  

Defined (1)

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

/wp-includes/cache.php  
  1. function wp_cache_incr( $key, $offset = 1, $group = '' ) { 
  2. global $wp_object_cache; 
  3.  
  4. return $wp_object_cache->incr( $key, $offset, $group );