Yoast\WP\SEO\Schema_Aggregator\Application\Cache

Manager::set │ public │ Yoast 1.0

Set cache data for a page

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

Хуков нет.

Возвращает

bool. Success.

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

$Manager = new Manager();
$Manager->set( $post_type, $page, $per_page, $data ): bool;
$post_type(строка) (обязательный)
The post type that the cache is for.
$page(int) (обязательный)
Page number.
$per_page(int) (обязательный)
Items per page.
$data(array) (обязательный)
Data to cache.

Код Manager::set() Yoast 28.9

public function set( string $post_type, int $page, int $per_page, array $data ): bool {
	try {
		if ( $page < 1 || $per_page < 1 || empty( $data ) ) {
			return false;
		}

		$key        = $this->get_cache_key( $post_type, $page, $per_page );
		$expiration = $this->config->get_expiration( $data );

		return \set_transient( $key, $data, $expiration );

	} catch ( Exception $e ) {
		return false;
	}
}