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

(int|string) (Required) The cache key to increment

$offset

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

Default value: 1

$group

(string) (Optional) The group the key is in.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

What are you looking for?