[wp-trac] [WordPress Trac] #56060: Implement wp_cache_replace_multiple() – and related WP_Object_Cache method

WordPress Trac noreply at wordpress.org
Fri Jun 24 02:50:19 UTC 2022


#56060: Implement wp_cache_replace_multiple() – and related WP_Object_Cache method
-----------------------------+-------------------------------------
 Reporter:  johnjamesjacoby  |      Owner:  (none)
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Cache API        |    Version:
 Severity:  normal           |   Keywords:  2nd-opinion needs-patch
  Focuses:  performance      |
-----------------------------+-------------------------------------
 See: #20875, #54574.

 See also: https://github.com/WordPress/wordpress-
 develop/pull/2018#discussion_r799643985

 🫠

 I would like to replace multiple values in a cache, but not `add` or `set`
 them if they do not exist.

 In my experience and understanding, `replace()` doesn't get much love
 because `_exists()` may be impossible to implement in certain backends –
 specifically (or especially) when `$group` is empty.

 My current situation is essentially juggling multiple backends, and only
 wanting to replace multiple values if they exist on one server and not add
 or set them until some other unrelated things happen.

 I went to call `wp_cache_replace_multiple()` and thought my IDE had
 deceived me when it wasn't autocompleting. Alas! Alas, I say!

 I can handle this In my own drop-in, and I can account for it in my own
 codes, but I think perhaps it's worth reconsidering this in core for the
 sake of parity with everything else.

 Thoughts?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56060>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list