Skip to content

Commit

Permalink
Use wp_cache_get_last_changed().
Browse files Browse the repository at this point in the history
  • Loading branch information
JJJ committed May 15, 2017
1 parent 45f1dea commit 485b20f
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,8 @@ public function get_site_aliases() {
do_action_ref_array( 'pre_get_site_aliases', array( &$this ) );

// $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
$key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
$last_changed = wp_cache_get( 'last_changed', 'blog-aliases' );

if ( false === $last_changed ) {
$last_changed = microtime();
wp_cache_set( 'last_changed', $last_changed, 'blog-aliases' );
}
$key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
$last_changed = wp_cache_get_last_changed( 'blog-aliases' );

// Check the cache
$cache_key = "get_site_aliases:{$key}:{$last_changed}";
Expand Down

0 comments on commit 485b20f

Please sign in to comment.