WP_Object_Cache::incr

Advertisement

Summery Summery

Increments numeric cache item’s value.

Syntax Syntax

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

Parameters Parameters

$key

(Required) The cache key to increment

$offset

(Optional) The amount by which to increment the item's value.

Default value: 1

$group

(Optional) The group the key is in. Default 'default'.

Default value: 'default'

Return Return

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

Source Source

File: wp-includes/class-wp-object-cache.php

	 */
	public function get_multiple( $keys, $group = 'default', $force = false ) {
		$values = array();

		foreach ( $keys as $key ) {
			$values[ $key ] = $this->get( $key, $group, $force );
		}

		return $values;
	}

	/**
	 * Increments numeric cache item's value.
	 *
	 * @since 3.3.0
	 *
	 * @param int|string $key    The cache key to increment
	 * @param int        $offset Optional. The amount by which to increment the item's value. Default 1.
	 * @param string     $group  Optional. The group the key is in. Default 'default'.
	 * @return int|false The item's new value on success, false on failure.
	 */
	public function incr( $key, $offset = 1, $group = 'default' ) {
		if ( empty( $group ) ) {
			$group = 'default';
		}

		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {

Advertisement

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.

Advertisement

Leave a Reply