[wp-trac] [WordPress Trac] #23167: Cache incrementors for get_pages
WordPress Trac
noreply at wordpress.org
Tue Jan 22 15:39:52 UTC 2013
#23167: Cache incrementors for get_pages
----------------------------------------+------------------------
Reporter: nprasath002 | Owner: westi
Type: task (blessed) | Status: reviewing
Priority: normal | Milestone: 3.6
Component: Cache | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests |
----------------------------------------+------------------------
Comment (by ryan):
{{{
$last_changed = wp_cache_set( 'last_changed', 1, 'posts' );
}}}
The default cache returns boolean true from wp_cache_set(). This works out
since true is cast to '1'. Some cache backends return void which is cast
to an empty string. If the same query is run again later in the page load
it uses a different cache key resulting in another query instead of using
the already cached query. The keys look like this:
{{{
get_pages:3577d9c3933b07d4dc753e71a0a49d72:
get_pages:3577d9c3933b07d4dc753e71a0a49d72:1
}}}
To accommodate non-compliant caches and to make the code clearer, let's
explicitly assign 1 to last_changed.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/23167#comment:11>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list