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

(int|string) (Required) What to call the contents in the cache.

$data

(mixed) (Required) The contents to store in the cache.

$group

(string) (Optional) Where to group the cache contents.

Default value: 'default'

$expire

(int) (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

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

What are you looking for?