wp_cache_incr()WP 3.3.0

Increments the value of the numeric cache item with the specified cache key and group.

If you want to decrement the value of the numeric cache item, use wp_cache_decr().

No Hooks.


Int|false. The item's new value on success, false on failure.


wp_cache_incr( $key, $offset, $group );
$key(int|string) (required)
The key for the cache contents that should be incremented.
The amount by which to increment the item's value.
Default: 1
The group the key is in.
Default: ''


#1 Increment cache value

Increment the value of the cache item in the group my_group with the key my_key by 10.

wp_cache_incr( 'my_key', 10, 'my_group' );



Since 3.3.0 Introduced.

Code of wp_cache_incr() WP 5.9.3

function wp_cache_incr( $key, $offset = 1, $group = '' ) {
	global $wp_object_cache;

	return $wp_object_cache->incr( $key, $offset, $group );