wppaste
WordPress

WP_Object_Cache::decr( int|string $key, int $offset = 1, string $group = 'default' ): int|false

Since
3.3.0
Source
wp-includes/class-wp-object-cache.php:519
Decrements numeric cache item's value.

Parameters

$keyint|string
The cache key to decrement.
$offsetintoptional
The amount by which to decrement the item's value. Default 1.Default: 1
$groupstringoptional
The group the key is in. Default 'default'.Default: 'default'

Return

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

Uses · 2

Source

	public function decr( $key, $offset = 1, $group = 'default' ) {		if ( ! $this->is_valid_key( $key ) ) {			return false;		} 		if ( empty( $group ) ) {			$group = 'default';		} 		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {			$key = $this->blog_prefix . $key;		} 		if ( ! $this->_exists( $key, $group ) ) {			return false;		} 		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) {			$this->cache[ $group ][ $key ] = 0;		} 		$offset = (int) $offset; 		$this->cache[ $group ][ $key ] -= $offset; 		if ( $this->cache[ $group ][ $key ] < 0 ) {			$this->cache[ $group ][ $key ] = 0;		} 		return $this->cache[ $group ][ $key ];	}

History

Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/class-wp-object-cache.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.