<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[30914] branches/4.1: Remove caching for `get_term_by()` calls.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/30914">30914</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/30914","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>johnbillion</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2014-12-16 19:06:15 +0000 (Tue, 16 Dec 2014)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Remove caching for `get_term_by()` calls.

The new cache group scheme causes term invalidation to be overly broad, so
that busting the cache for one term will bust the cache for all terms in the
taxonomy. We'll have another go at more focused use of the 'last_changed'
incrementor in a future release.

Reverts <a href="https://core.trac.wordpress.org/changeset/29915">[29915]</a>, <a href="https://core.trac.wordpress.org/changeset/30073">[30073]</a>, <a href="https://core.trac.wordpress.org/changeset/30080">[30080]</a>, <a href="https://core.trac.wordpress.org/changeset/30108">[30108]</a>, <a href="https://core.trac.wordpress.org/changeset/30112">[30112]</a>.

Merges <a href="https://core.trac.wordpress.org/changeset/30900">[30900]</a> to the 4.1 branch.

See <a href="https://core.trac.wordpress.org/ticket/21760">#21760</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches41srcwpincludestaxonomyphp">branches/4.1/src/wp-includes/taxonomy.php</a></li>
<li><a href="#branches41testsphpunitteststermcachephp">branches/4.1/tests/phpunit/tests/term/cache.php</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#branches41">branches/4.1/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/4.1
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/4.1 2014-12-16 17:34:57 UTC (rev 30913)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/4.1  2014-12-16 19:06:15 UTC (rev 30914)
</ins><a id="branches41"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/4.1</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/3.1:18031
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.3:20543
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/3.4:21757
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:18512,30801-30813,30817,30821,30823-30824,30829-30832,30835,30837,30839-30843,30846-30847,30849,30854,30856-30857,30865-30867,30873-30874,30879,30884,30887-30890,30903
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:18512,30801-30813,30817,30821,30823-30824,30829-30832,30835,30837,30839-30843,30846-30847,30849,30854,30856-30857,30865-30867,30873-30874,30879,30884,30887-30890,30900,30903
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches41srcwpincludestaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.1/src/wp-includes/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.1/src/wp-includes/taxonomy.php 2014-12-16 17:34:57 UTC (rev 30913)
+++ branches/4.1/src/wp-includes/taxonomy.php   2014-12-16 19:06:15 UTC (rev 30914)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1305,24 +1305,19 @@
</span><span class="cx" style="display: block; padding: 0 10px">                return $error;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $incrementor = wp_cache_get( 'last_changed', 'terms' );
</del><span class="cx" style="display: block; padding: 0 10px">         if ( is_object($term) && empty($term->filter) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                wp_cache_add( $term->term_id, $term, $taxonomy . ':terms:' . $incrementor );
-               wp_cache_add( $term->slug, $term->term_id, $taxonomy . ':slugs:' . $incrementor );
-               wp_cache_add( $term->name, $term->term_id, $taxonomy . ':names:' . $incrementor );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         wp_cache_add( $term->term_id, $term, $taxonomy );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $_term = $term;
</span><span class="cx" style="display: block; padding: 0 10px">        } else {
</span><span class="cx" style="display: block; padding: 0 10px">                if ( is_object($term) )
</span><span class="cx" style="display: block; padding: 0 10px">                        $term = $term->term_id;
</span><span class="cx" style="display: block; padding: 0 10px">                if ( !$term = (int) $term )
</span><span class="cx" style="display: block; padding: 0 10px">                        return null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ! $_term = wp_cache_get( $term, $taxonomy . ':terms:' . $incrementor ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! $_term = wp_cache_get( $term, $taxonomy ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %d LIMIT 1", $taxonomy, $term) );
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ! $_term )
</span><span class="cx" style="display: block; padding: 0 10px">                                return null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        wp_cache_add( $term, $_term, $taxonomy . ':terms:' . $incrementor );
-                       wp_cache_add( $_term->slug, $term, $taxonomy . ':slugs:' . $incrementor );
-                       wp_cache_add( $_term->name, $term, $taxonomy . ':names:' . $incrementor );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 wp_cache_add( $term, $_term, $taxonomy );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1393,47 +1388,31 @@
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! taxonomy_exists($taxonomy) )
</span><span class="cx" style="display: block; padding: 0 10px">                return false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $cache = false;
-       $incrementor = wp_cache_get( 'last_changed', 'terms' );
</del><span class="cx" style="display: block; padding: 0 10px">         if ( 'slug' == $field ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $field = 't.slug';
</span><span class="cx" style="display: block; padding: 0 10px">                $value = sanitize_title($value);
</span><span class="cx" style="display: block; padding: 0 10px">                if ( empty($value) )
</span><span class="cx" style="display: block; padding: 0 10px">                        return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-               $term_id = wp_cache_get( $value, $taxonomy . ':slugs:' . $incrementor );
-               if ( $term_id ) {
-                       $value = $term_id;
-                       $cache = true;
-               }
</del><span class="cx" style="display: block; padding: 0 10px">         } else if ( 'name' == $field ) {
</span><span class="cx" style="display: block; padding: 0 10px">                // Assume already escaped
</span><span class="cx" style="display: block; padding: 0 10px">                $value = wp_unslash($value);
</span><span class="cx" style="display: block; padding: 0 10px">                $field = 't.name';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $term_id = wp_cache_get( $value, $taxonomy . ':names:' . $incrementor  );
-               if ( $term_id ) {
-                       $value = $term_id;
-                       $cache = true;
-               }
</del><span class="cx" style="display: block; padding: 0 10px">         } else if ( 'term_taxonomy_id' == $field ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $value = (int) $value;
</span><span class="cx" style="display: block; padding: 0 10px">                $field = 'tt.term_taxonomy_id';
</span><span class="cx" style="display: block; padding: 0 10px">        } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $cache = true;
-       }
-
-       if ( $cache ) {
-               $term = get_term( (int) $value, $taxonomy, $output, $filter);
-               if ( is_wp_error( $term ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $term = get_term( (int) $value, $taxonomy, $output, $filter );
+               if ( is_wp_error( $term ) )
</ins><span class="cx" style="display: block; padding: 0 10px">                         $term = false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                }
-       } else {
-               $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         return $term;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( !$term )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value ) );
+       if ( ! $term )
</ins><span class="cx" style="display: block; padding: 0 10px">                 return false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        wp_cache_add( $term->term_id, $term, $taxonomy );
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /** This filter is documented in wp-includes/taxonomy.php */
</span><span class="cx" style="display: block; padding: 0 10px">        $term = apply_filters( 'get_term', $term, $taxonomy );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1442,10 +1421,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $term = sanitize_term($term, $taxonomy, $filter);
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        wp_cache_add( $term->term_id, $term, $taxonomy . ':terms:' . $incrementor );
-       wp_cache_add( $term->slug, $term->term_id, $taxonomy . ':slugs:' . $incrementor );
-       wp_cache_add( $term->name, $term->term_id, $taxonomy . ':names:' . $incrementor );
-
</del><span class="cx" style="display: block; padding: 0 10px">         if ( $output == OBJECT ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return $term;
</span><span class="cx" style="display: block; padding: 0 10px">        } elseif ( $output == ARRAY_A ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3649,12 +3624,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @param bool $clean_taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        global $_wp_suspend_cache_invalidation, $wpdb;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wpdb;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
-               return;
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         if ( !is_array($ids) )
</span><span class="cx" style="display: block; padding: 0 10px">                $ids = array($ids);
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3792,22 +3763,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string $taxonomy Optional. Update Term to this taxonomy in cache
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function update_term_cache($terms, $taxonomy = '') {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        global $_wp_suspend_cache_invalidation;
-
-       if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
-               return;
-       }
-
</del><span class="cx" style="display: block; padding: 0 10px">         foreach ( (array) $terms as $term ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $term_taxonomy = $taxonomy;
</span><span class="cx" style="display: block; padding: 0 10px">                if ( empty($term_taxonomy) )
</span><span class="cx" style="display: block; padding: 0 10px">                        $term_taxonomy = $term->taxonomy;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $incrementor = wp_cache_set( 'last_changed', microtime(), 'terms' );
-
-               wp_cache_add( $term->term_id, $term, $term_taxonomy . ':terms:' . $incrementor );
-               wp_cache_add( $term->slug, $term->term_id, $taxonomy . ':slugs:' . $incrementor );
-               wp_cache_add( $term->name, $term->term_id, $taxonomy . ':names:' . $incrementor );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         wp_cache_add( $term->term_id, $term, $term_taxonomy );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="branches41testsphpunitteststermcachephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/4.1/tests/phpunit/tests/term/cache.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/4.1/tests/phpunit/tests/term/cache.php   2014-12-16 17:34:57 UTC (rev 30913)
+++ branches/4.1/tests/phpunit/tests/term/cache.php     2014-12-16 19:06:15 UTC (rev 30914)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -93,122 +93,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                _unregister_taxonomy( $tax );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       /**
-        * @ticket 21760
-        */
-       function test_get_term_by_slug_cache() {
-               global $wpdb;
-               $term_id = $this->factory->term->create( array( 'slug' => 'burrito', 'taxonomy' => 'post_tag' ) );
-
-               $queries = $wpdb->num_queries;
-               get_term_by( 'slug', 'burrito', 'post_tag' );
-               $initial = $queries + 1;
-               $this->assertEquals( $initial, $wpdb->num_queries );
-               $term = get_term_by( 'slug', 'burrito', 'post_tag' );
-               $this->assertEquals( $initial, $wpdb->num_queries );
-
-               $this->assertEquals( $term, wp_cache_get( $term_id, 'post_tag:terms:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-
-               $this->assertEquals( get_term( $term_id, 'post_tag' ), $term );
-               $this->assertEquals( $initial, $wpdb->num_queries );
-       }
-
-       /**
-        * @ticket 21760
-        */
-       function test_get_term_by_slug_cache_update() {
-               global $wpdb;
-               $term_id = $this->factory->term->create( array( 'slug' => 'burrito', 'taxonomy' => 'post_tag' ) );
-
-               $queries = $wpdb->num_queries;
-               get_term_by( 'slug', 'burrito', 'post_tag' );
-               $initial = $queries + 1;
-               $this->assertEquals( $initial, $wpdb->num_queries );
-               $term = get_term_by( 'slug', 'burrito', 'post_tag' );
-               $this->assertEquals( $initial, $wpdb->num_queries );
-
-               $this->assertEquals( $term, wp_cache_get( $term_id, 'post_tag:terms:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-
-               wp_update_term( $term_id, 'post_tag', array( 'name' => 'Taco' ) );
-               $this->assertNotEquals( $term, get_term( $term_id, 'post_tag' ) );
-               $after_queries = $wpdb->num_queries;
-               get_term_by( 'slug', 'burrito', 'post_tag' );
-               $this->assertEquals( $after_queries, $wpdb->num_queries );
-       }
-
-       /**
-        * @ticket 21760
-        */
-       function test_get_term_by_name_cache() {
-               global $wpdb;
-               $term_id = $this->factory->term->create( array( 'name' => 'burrito', 'taxonomy' => 'post_tag' ) );
-
-               $queries = $wpdb->num_queries;
-               get_term_by( 'name', 'burrito', 'post_tag' );
-               $initial = $queries + 1;
-               $this->assertEquals( $initial, $wpdb->num_queries );
-               $term = get_term_by( 'name', 'burrito', 'post_tag' );
-               $this->assertEquals( $initial, $wpdb->num_queries );
-
-               $this->assertEquals( get_term( $term_id, 'post_tag' ), $term );
-               $this->assertEquals( $initial, $wpdb->num_queries );
-       }
-
-       /**
-        * @ticket 21760
-        */
-       function test_get_term_by_name_cache_update() {
-               global $wpdb;
-               $term_id = $this->factory->term->create( array( 'name' => 'burrito', 'taxonomy' => 'post_tag' ) );
-
-               $queries = $wpdb->num_queries;
-               get_term_by( 'name', 'burrito', 'post_tag' );
-               $initial = $queries + 1;
-               $this->assertEquals( $initial, $wpdb->num_queries );
-               $term = get_term_by( 'name', 'burrito', 'post_tag' );
-               $this->assertEquals( $initial, $wpdb->num_queries );
-
-               wp_update_term( $term_id, 'post_tag', array( 'slug' => 'Taco' ) );
-               $this->assertNotEquals( $term, get_term( $term_id, 'post_tag' ) );
-               $after_queries = $wpdb->num_queries;
-               get_term_by( 'name', 'burrito', 'post_tag' );
-               $this->assertEquals( $after_queries, $wpdb->num_queries );
-       }
-
-       /**
-        * @ticket 21760
-        */
-       function test_invalidating_term_caches_should_fail_when_invalidation_is_suspended() {
-               $slug = 'taco';
-               $name = 'Taco';
-               $taxonomy = 'post_tag';
-               $cache_key_slug = $slug;
-               $cache_key_name = $name;
-
-               $term_id = $this->factory->term->create( array( 'slug' => $slug, 'name' => $name, 'taxonomy' => $taxonomy ) );
-
-               $last_changed = wp_cache_get( 'last_changed', 'terms' );
-
-               $term = get_term_by( 'slug', $slug, $taxonomy );
-
-               // Verify the term is cached by ID, slug and name
-               $this->assertEquals( $term, wp_cache_get( $term_id, $taxonomy . ':terms:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-               $this->assertSame( $term_id, wp_cache_get( $cache_key_slug, $taxonomy . ':slugs:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-               $this->assertSame( $term_id, wp_cache_get( $cache_key_name, $taxonomy . ':names:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-
-               $suspend = wp_suspend_cache_invalidation();
-               clean_term_cache( $term_id, $taxonomy );
-
-               // Verify that the cached value still matches the correct value
-               $this->assertEquals( $term, wp_cache_get( $term_id, $taxonomy . ':terms:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-               $this->assertSame( $term_id, wp_cache_get( $cache_key_slug, $taxonomy . ':slugs:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-               $this->assertSame( $term_id, wp_cache_get( $cache_key_name, $taxonomy . ':names:' . wp_cache_get( 'last_changed', 'terms' ) ) );
-
-               // Verify that last changed has not been updated as part of an invalidation routine
-               $this->assertSame( $last_changed, wp_cache_get( 'last_changed', 'terms' ) );
-
-               // Clean up.
-               wp_suspend_cache_invalidation( $suspend );
-       }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>

</body>
</html>