[wp-trac] [WordPress Trac] #58650: Reset cache in development mode

WordPress Trac noreply at wordpress.org
Wed Jun 28 17:47:41 UTC 2023


#58650: Reset cache in development mode
-------------------------+------------------------------
 Reporter:  ramonopoly   |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Cache API    |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------
Changes (by flixos90):

 * type:  feature request => enhancement
 * reporter:  ramonopoly, noisysocks => ramonopoly


Comment:

 (fixing the double issue reporter here, cc'ing @noisysocks instead 🙂)

 Reviewing this more closely, it seems at this point Gutenberg setting the
 `WP_RUN_CORE_TESTS` constant is the most appropriate solution indeed - and
 since arguably Gutenberg can be considered part of core in a certain way,
 it may even make sense to handle its own unit tests the same way as core
 tests. So potentially this isn't even just a workaround, but a long-term
 acceptable solution.

 That said, I acknowledge that using a static variable here makes cache
 clearing impossible. If I remember correctly, it was decided to go with
 that approach since the function is called so many times, the value should
 never change within a single page load, and even using an object cache
 would have a higher overhead so that was avoided here.

 Changing this production code just because a test needs it, in a way that
 is less performant is questionable. On the other hand, we may only be nit-
 picking about an irrelevant difference. Maybe we could use a non-
 persistent cache group? Aren't those typically just using a variable or
 class property in PHP anyway, even on sites that use a persistent object
 cache layer? If so, I think that would be a good solution.

 cc @spacedmonkey @oandregal since I believe you were involved in the
 original discussions

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


More information about the wp-trac mailing list