[wp-trac] [WordPress Trac] #21760: get_term_by() calls are not cached
WordPress Trac
wp-trac at lists.automattic.com
Tue Sep 4 17:15:12 UTC 2012
#21760: get_term_by() calls are not cached
----------------------------------------+------------------------------
Reporter: wonderboymusic | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 2.3
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests |
----------------------------------------+------------------------------
Comment (by nacin):
Some thoughts:
* The code in delete_term_cache() seems like it belongs in
clean_term_cache(). (This code is similarly in clean_user_cache().)
* Not *entirely* sure that term_cache_group() is necessary. It only gets
called in get_term(), get_term_by(), get_terms(), and a few relationship
functions. Doing "taxonomy:$taxonomy:slugs" etc. seems pretty safe, and
not unreasonably more complicated (or longer) than _term_cache_group().
Though... we might need to special-case the core taxonomies to avoid
renaming those buckets, as ryan pointed out.
* With user login, slug, and email buckets, we don't cache the user
object, but rather, just the ID. That way, we can then consult the ID-
based bucket for the object. We should do the same here. See
WP_User::get_data_by() for how that works.
* Removing list_terms_exclusions should probably come in the separate
ticket, #21267.
* In get_cat_ID(), you changed if ( $cat ) to an is_object() check. Is
that necessary? Will get_term_by() ever turn a value that evaluates to
true that is *not* an object?
* I had to do an `svn diff -x --ignore-all-space` to be able to review
the patch effectively. Whitespace changes, especially in functions not
quite touched by the patch, make things a bit more difficult to review.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21760#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list