wp_cache_set_last_changed

函式
wp_cache_set_last_changed ( $group )
引數
  • (string) $group Where the cache contents are grouped.
    Required:
返回值
  • (string) UNIX timestamp when the group was last changed.
定義位置
相關方法
wp_cache_get_last_changedwp_cache_set_users_last_changedwp_cache_set_terms_last_changedwp_cache_set_sites_last_changedwp_cache_set_posts_last_changed
引入
6.3.0
棄用
-

將指定快取組的上次更改日期設定為現在。

function wp_cache_set_last_changed( $group ) {
	$previous_time = wp_cache_get( 'last_changed', $group );

	$time = microtime();

	wp_cache_set( 'last_changed', $time, $group );

	/**
	 * Fires after a cache group `last_changed` time is updated.
	 * This may occur multiple times per page load and registered
	 * actions must be performant.
	 *
	 * @since 6.3.0
	 *
	 * @param string    $group         The cache group name.
	 * @param int       $time          The new last changed time.
	 * @param int|false $previous_time The previous last changed time. False if not previously set.
	 */
	do_action( 'wp_cache_set_last_changed', $group, $time, $previous_time );

	return $time;
}

常見問題

FAQs
檢視更多 >