﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
23059,"if object cache entry for last_changed in term and comments groups is purged, it invalidase too many cached items",mark-k,,"Some context to explain the issue - I was trying to be smart and cache menu generation by setting my own object temporary object caching just before the outputing the menu and saving the resulting cache to an option. On next page load I populated the cache for the option before outputting the menu.
It didn't work.

After some digging I found out that the cache key for the menu terms composed as ""get_terms:$key:$last_changed"" and that the $last_changed part was different in every run. So I went an looked how it is set and everything became clear


{{{
	$last_changed = wp_cache_get('last_changed', 'terms');
	if ( !$last_changed ) {
		$last_changed = time();
		wp_cache_set('last_changed', $last_changed, 'terms');
	}

}}}

Because I am running without object cache before the menu code is executed $last_changed changes every run.

This might be an edge case, but IMO it means that whenever 'last_changed' is purged/garbage collected all the terms related cached values are practically invalidated as well.

I really don't understand why the value is part of the cache key at all, but if it has to be shouldn't it be stored in a less volatile storage?

related #22024. It is closed but I think that change also doesn't handle well the situation where last_changed for comments is purged",defect (bug),closed,normal,,Cache,3.5,normal,wontfix,,johnbillion
