[wp-trac] [WordPress Trac] #47871: Cache item schema in REST controllers
WordPress Trac
noreply at wordpress.org
Wed Aug 14 20:28:14 UTC 2019
#47871: Cache item schema in REST controllers
-------------------------------------------------+-------------------------
Reporter: joehoyle | Owner: kadamwhite
Type: enhancement | Status: accepted
Priority: normal | Milestone: 5.3
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch needs-testing dev- | Focuses:
feedback |
-------------------------------------------------+-------------------------
Comment (by kadamwhite):
A note on the above patch: I opted to cache only the value of the schema
computed within the `get_item_schema` method, and not the final output of
`$this->add_additional_fields_schema()`. In theory we could probably cache
that final value safely in most cases, as an individual REST response
lifecycle is fairly self-contained and linear; but in practice the order
of operations we test for in our unit test suite currently validates that
we can append rest fields to an endpoint between endpoint instantiation
and the delivery of the final request, and it seemed unsafe to break that
assumption.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47871#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list