WP_Object_Cache::replace

Advertisement

Summery Summery

Replaces the contents in the cache, if contents already exist.

Syntax Syntax

WP_Object_Cache::replace( int|string $key, mixed $data, string $group = 'default', int $expire )

Parameters Parameters

$key

(Required) What to call the contents in the cache.

$data

(Required) The contents to store in the cache.

$group

(Optional) Where to group the cache contents. Default 'default'.

Default value: 'default'

$expire

(Optional) When to expire the cache contents. Default 0 (no expiration).

Return Return

(bool) False if not exists, true if contents were replaced.

Source Source

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

		if ( $this->cache[ $group ][ $key ] < 0 ) {
			$this->cache[ $group ][ $key ] = 0;
		}

		return $this->cache[ $group ][ $key ];
	}

	/**
	 * Replaces the contents in the cache, if contents already exist.
	 *
	 * @since 2.0.0
	 *
	 * @see WP_Object_Cache::set()
	 *
	 * @param int|string $key    What to call the contents in the cache.

Advertisement

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

See also See also

Advertisement

Leave a Reply