wp_cache_decr()WP 3.3.0

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

If you want to increment the value of the numeric cache item, use wp_cache_incr().

No Hooks.


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


wp_cache_decr( $key, $offset, $group );
$key(int|string) (required)
The cache key to decrement.
The amount by which to decrement the item's value.
Default: 1
The group the key is in.
Default: ''


#1 Decrement cache value

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

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



Since 3.3.0 Introduced.

Code of wp_cache_decr() WP 5.9.3

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

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