WP_Object_Cache::delete()publicWP 2.0.0

Removes the contents of the cache key in the group.

If the cache key does not exist in the group, then nothing will happen.

Метод класса: WP_Object_Cache{}

Хуков нет.

Возвращает

true|false. True on success, false if the contents were not deleted.

Использование

$WP_Object_Cache = new WP_Object_Cache();
$WP_Object_Cache->delete( $key, $group, $deprecated );
$key(int|строка) (обязательный)
What the contents in the cache are called.
$group(строка)
Where the cache contents are grouped.
По умолчанию: 'default'
$deprecated(true|false)
Unused.
По умолчанию: false

Список изменений

С версии 2.0.0 Введена.

Код WP_Object_Cache::delete() WP 6.4.3

public function delete( $key, $group = 'default', $deprecated = false ) {
	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;
	}

	unset( $this->cache[ $group ][ $key ] );
	return true;
}