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-79: Implement `wp_cache_(add|delete|set)_multiple` #87

Closed sjinks closed 2 years ago

sjinks commented 2 years ago

This PR adds support for wp_cache_add_multiple(), wp_cache_delete_multiple(), and wp_cache_set_multiple() functions introduced in WP 6.0.

However, because Memcache PHP extension does not support multi methods, this PR does not bring performance improvements.

Closes: #79

codecov[bot] commented 2 years ago

Codecov Report

Merging #87 (6b44684) into master (e9ef44c) will increase coverage by 0.10%. The diff coverage is 100.00%.

:exclamation: Current head 6b44684 differs from pull request most recent head 01eda42. Consider uploading reports for the commit 01eda42 to get more accurate results

@@             Coverage Diff              @@
##             master      #87      +/-   ##
============================================
+ Coverage     76.26%   76.36%   +0.10%     
- Complexity      138      144       +6     
============================================
  Files             1        1              
  Lines           434      457      +23     
============================================
+ Hits            331      349      +18     
- Misses          103      108       +5     
Flag Coverage Δ
unittests 76.36% <100.00%> (+0.10%) :arrow_up:

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

Impacted Files Coverage Δ
object-cache.php 76.36% <100.00%> (+0.10%) :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 e9ef44c...01eda42. Read the comment docs.

spacedmonkey commented 2 years ago

Memcache is not supported in PHP 7.0+. https://www.php.net/manual/en/book.memcache.php#121617

sjinks commented 2 years ago

@spacedmonkey I am afraid that we use memcache in production; memcached is not even installed.

root@vip-testing-wwa83-sbx-u505-656589c658-vftdm:~# php -m | grep -i memcache
memcache
root@vip-testing-wwa83-sbx-u505-656589c658-vftdm:~# php -v
PHP 7.4.29 (cli) (built: May 11 2022 14:30:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.29, Copyright (c), by Zend Technologies
    with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans
sjinks commented 2 years ago

https://pecl.php.net/package-changelog.php?package=memcache&release=8.0

  • Version 8.x support PHP 8.x
  • Version 4.x supports PHP 7.0-7.4.
  • Version 4.x is considered to be stable for production usage.
sjinks commented 2 years ago

Also, even if we used memcached instead of memcache, I am afraid there would be no performance improvement:

  1. The memcached protocol does not have multi versions of storage commands;
  2. The memcached extension implements deleteMulti and setMulti as calls to set or delete in a foreach loop -- the same way as we implement them in the userland.
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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication