[wp-trac] [WordPress Trac] #36711: Add caching to get_page_by_path

WordPress Trac noreply at wordpress.org
Sat May 21 03:11:33 UTC 2016


#36711: Add caching to get_page_by_path
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  4.6
Component:  Posts, Post Types                    |     Version:  2.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests dev-        |     Focuses:
  feedback                                       |  performance
-------------------------------------------------+-------------------------
Changes (by boonebgorges):

 * milestone:  Awaiting Review => 4.6


Comment:

 @spacedmonkey Thanks for your work here.

 The approach in [attachment:36711.4.patch] will not work, because a page's
 path depends on pages other than itself. For example, a page `/foo/bar`
 with a parent of `foo` will get a new patch if `foo` changes to `baz`. It
 would probably be possible to build a more targeted invalidation routine.
 It'd mean that when a page's path is updated, the path cache of each of
 its descendants must also be updated. This is a lot of code and a lot of
 overhead for a small improvement, so I'd suggest we skip it for now and go
 with the more general `last_changed` technique.

 [attachment:36711.5.patch] cleans up the improvements in
 [attachment:36711.3.patch] and clarifies the tests. I think it's a pretty
 safe change, but I'd appreciate another set of eyes.

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


More information about the wp-trac mailing list