[wp-trac] [WordPress Trac] #58657: Add in missing caching to `get_item_schema` method to new endpoint

WordPress Trac noreply at wordpress.org
Thu Aug 3 12:16:52 UTC 2023


#58657: Add in missing caching to `get_item_schema` method to new endpoint
------------------------------+---------------------------
 Reporter:  spacedmonkey      |       Owner:  spacedmonkey
     Type:  defect (bug)      |      Status:  reopened
 Priority:  normal            |   Milestone:  6.3
Component:  REST API          |     Version:  5.0
 Severity:  normal            |  Resolution:
 Keywords:  has-patch commit  |     Focuses:  performance
------------------------------+---------------------------
Changes (by david.binda):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Reviewing the r56093 , it's adding a caching to the
 `WP_REST_Blocks_Controller::get_item_schema` right above a comment which
 says: `// Do not cache this schema because all properties are derived from
 parent controller.` ( see
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/endpoints/class-wp-rest-blocks-controller.php?rev=56093#L75 )

 I haven't been able to figure out whether the caching was omitted here as
 redundant or whether there are any functional limits to the caching.

 IMHO, either the comment should be removed as misleading, or the caching
 should not have be added there. There might a similar case in
 `WP_REST_Menus_Controller::get_item_schema` which is also deriving the
 properties from parent controller ( see
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/endpoints/class-wp-rest-menus-controller.php?rev=56093#L530 )

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


More information about the wp-trac mailing list