lscache_wp icon indicating copy to clipboard operation
lscache_wp copied to clipboard

Implement wp_cache_get_multiple.

Open spacedmonkey opened this issue 4 years ago • 9 comments

See https://make.wordpress.org/core/2020/08/11/introduce-wp_cache_get_multiple/

spacedmonkey avatar Aug 12 '20 16:08 spacedmonkey

Hi, so is it already implemented?

priard avatar Apr 20 '21 13:04 priard

Seems that the compatibility shim mentioned in that post may cover it for now.

"95% of the performance-related problems that users report on a regular basis (aside from using Redis data structures incorrectly)" can be addressed by implementing pipelining (which I assume wp_cache_get_multiple() is for) & reusing Redis connections (already implemented) https://redislabs.com/ebook/part-2-core-concepts/chapter-4-keeping-data-safe-and-ensuring-performance/4-6-performance-considerations/

J-Rey avatar Jul 25 '21 17:07 J-Rey

Any update on this?

spacedmonkey avatar Feb 11 '22 13:02 spacedmonkey

Hi, so is it already implemented?

Hi @priard - yes, this is available in WP core since 5.5.

adamsilverstein avatar Mar 23 '23 14:03 adamsilverstein

Here is a write up on the importance of this function.

https://xwp.co/easy-performance-wins-with-opt-in-caching-improvements/

Any chance this could be in an upcoming release? @hi-hai @tynanbe

spacedmonkey avatar Apr 04 '23 12:04 spacedmonkey

It already is, @spacedmonkey :slightly_smiling_face: https://github.com/litespeedtech/lscache_wp/blob/master/src/object.lib.php#L178

tynanbe avatar May 10 '23 14:05 tynanbe

@tynanbe No it's does not 😄

Look here

https://github.com/litespeedtech/lscache_wp/blob/d1a0aef92424d1c32886f4d594e094ade141d6ad/src/object.lib.php#L834-L842

All this does, it loops through the array of elements one at time. You get no benefit to doing this. And it basically what is already in core. For memcached you need to use the method getMulti like this example or Redis use MGET ( passing multiple keys ) like this example. Getting more keys at once, saves lots time going backwards and forth between the object cache server.

Worth reviewing this article and see the benefits of doing this.

spacedmonkey avatar May 10 '23 14:05 spacedmonkey

While looking into this, it would also be nice if you could add wp_cache_supports function to your code base as well. This was added https://github.com/WordPress/wordpress-develop/commit/832b6c35f36d5f1ca84feadc49b0e5424af0ad6c in WP 6.1. See this article for more details.

spacedmonkey avatar May 11 '23 13:05 spacedmonkey

While looking into this, it would also be nice if you could add wp_cache_supports function to your code base as well. This was added WordPress/wordpress-develop@832b6c3 in WP 6.1. See this article for more details.

https://github.com/litespeedtech/lscache_wp/blob/master/src/object.lib.php#L322

tynanbe avatar May 11 '23 13:05 tynanbe