[wp-trac] [WordPress Trac] #55999: wp_suspend_cache_addition should also disable cache setting?

WordPress Trac noreply at wordpress.org
Sun Feb 4 12:01:35 UTC 2024


#55999: wp_suspend_cache_addition should also disable cache setting?
-------------------------------------------------+-------------------------
 Reporter:  malthert                             |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Cache API                            |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch 2nd-opinion has-unit-      |     Focuses:
  tests                                          |  performance
-------------------------------------------------+-------------------------
Changes (by kkmuffme):

 * keywords:  has-patch needs-unit-tests 2nd-opinion => has-patch 2nd-
     opinion has-unit-tests


Comment:

 >During a large import for example, suspending cache addition makes sense
 to avoid consuming a large amount of memory (particularly when inserting
 terms and post meta), but updating existing cache entries may well be
 desirable and expected.

 - for incr/decr it will end up with wrong values if only "add" is
 suspended but you then call incr/decr on it. For these 2 it's breaking but
 the original behavior was unintended and there isn't a use case I can
 think of where this is expected.

 - for set: it's breaking what is currently broken = making it work as
 expected :-) when using a persistent cache backend. The current behavior
 is a massive source of race conditions causing invalid cache states.
 Additionally, from the function description of the suspend function it
 reads as it will suspend all "adding" to cache - that it previously only
 stopped "add" is mostly unexpected I'd say.

 I'm also not really able to come up with any example where you want to
 disable "add" but still be able to "set"?

 ---

 Added unit tests now

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


More information about the wp-trac mailing list