wp_cache_get_last_changed() WordPress Function

The wp_cache_get_last_changed() function is used to get the timestamp of the last time a given key was updated in the cache. This can be useful for checking if cached data is still fresh, or for invalidating all cached data when a significant event occurs.

wp_cache_get_last_changed( string $group ) #

Gets last changed date for the specified cache group.


Parameters

$group

(string)(Required)Where the cache contents are grouped.


Top ↑

Return

(string) UNIX timestamp with microseconds representing when the group was last changed.


Top ↑

Source

File: wp-includes/functions.php

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

	if ( ! $last_changed ) {
		$last_changed = microtime();
		wp_cache_set( 'last_changed', $last_changed, $group );
	}

	return $last_changed;
}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More