Automattic / wp-memcached

Memcached Object Cache for WordPress.
https://wordpress.org/plugins/memcached/
GNU General Public License v2.0
159 stars 55 forks source link

GH-63: Implement wp_cache_get_multiple() #88

Closed sjinks closed 2 years ago

sjinks commented 2 years ago

This PR adds support for the wp_cache_get_multiple() function introduced in WordPress 5.5.

Fixes #63

codecov[bot] commented 2 years ago

Codecov Report

Merging #88 (1d00012) into master (d8084f4) will increase coverage by 1.62%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##             master      #88      +/-   ##
============================================
+ Coverage     77.75%   79.38%   +1.62%     
- Complexity      145      158      +13     
============================================
  Files             1        1              
  Lines           454      485      +31     
============================================
+ Hits            353      385      +32     
+ Misses          101      100       -1     
Flag Coverage Δ
unittests 79.38% <100.00%> (+1.62%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
object-cache.php 79.38% <100.00%> (+1.62%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d8084f4...1d00012. Read the comment docs.

rinatkhaziev commented 2 years ago

I just tagged some folks to whom this may be relevant.

WPprodigy commented 2 years ago

Wanted to mention that last time I played around with the "send an array of keys to get()" functionality, it turned out it handled some edge cases differently - particularly null: https://github.com/Automattic/wp-memcached/pull/69#issuecomment-777098808

So in wp_cache_get_multiple() we just need to make sure the exact same values are returned for single keys as they would be for wp_cache_get(). So null, empty string/array, false, etc.

sjinks commented 2 years ago

My tests show that we have issues with null only in PHP 8; PHP 7.4 returns null as null; this happens only when we are trying to get a single key. The multikey version is not affected by the bug.

sjinks commented 2 years ago

This is where they broke the old behavior of memcache_get().

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication