[wp-trac] [WordPress Trac] #22526: Changing category doesn't invalidate cache

WordPress Trac noreply at wordpress.org
Wed Feb 5 05:06:35 UTC 2014


#22526: Changing category doesn't invalidate cache
-----------------------------------------------+--------------------
 Reporter:  Whissi                             |       Owner:
     Type:  defect (bug)                       |      Status:  new
 Priority:  normal                             |   Milestone:  3.9
Component:  Cache API                          |     Version:  3.4.2
 Severity:  normal                             |  Resolution:
 Keywords:  needs-unit-tests has-patch commit  |     Focuses:
-----------------------------------------------+--------------------
Changes (by wonderboymusic):

 * keywords:  needs-patch needs-unit-tests => needs-unit-tests has-patch
     commit


Comment:

 Bugs like this give me nightmares. [attachment:22526.diff 22526.diff]
 keeps the post terms cache in sync with changes to a given taxonomy.

 Introduces 3 new functions:
 `get_taxonomy_last_changed( $taxonomy )`
 `set_taxonomy_last_changed( $taxonomy )`
 `post_taxonomy_is_fresh( $id, $taxonomy )`

 `post_taxonomy_is_fresh()` only needs to be called in
 `get_object_term_cache()`. Added some unit tests for the functions and for
 the condition described in the ticket which, surprise surprise, was
 reproducible with a basic unit test.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22526#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list