Redis Object Cache - Version 2.0.11

Version Description

  • Fixed an issue in wp_cache_get_multiple() when using Predis
  • Prevent undefined index notice in diagnostics
Download this release

Release Info

Developer tillkruess
Plugin Icon 128x128 Redis Object Cache
Version 2.0.11
Comparing to
See all releases

Code changes from version 2.0.10 to 2.0.11

includes/object-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Redis Object Cache Drop-In
4
  * Plugin URI: http://wordpress.org/plugins/redis-cache/
5
  * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Credis, HHVM, replication, clustering and WP-CLI.
6
- * Version: 2.0.10
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
9
  * License: GPLv3
@@ -1379,13 +1379,13 @@ LUA;
1379
  $start_time = microtime( true );
1380
 
1381
  try {
 
 
 
 
1382
  $results = array_combine(
1383
  $remaining_keys,
1384
- $this->redis->mget(
1385
- array_map( function ( $key ) use ( $derived_keys ) {
1386
- return $derived_keys[ $key ];
1387
- }, $remaining_keys )
1388
- )
1389
  );
1390
  } catch ( Exception $exception ) {
1391
  $this->handle_exception( $exception );
@@ -1399,15 +1399,14 @@ LUA;
1399
  $this->cache_time += $execute_time;
1400
 
1401
  foreach ( $results as $key => $value ) {
1402
- $value = $this->maybe_unserialize($value);
1403
- $cache[ $key ] = $value;
1404
-
1405
- if ( $value === false ) {
1406
  $this->cache_misses++;
1407
  } else {
1408
- $this->cache_hits++;
 
1409
 
1410
- $this->add_to_internal_cache( $derived_keys[ $key ], $value );
1411
  }
1412
  }
1413
 
@@ -1620,6 +1619,8 @@ LUA;
1620
  );
1621
 
1622
  return (object) [
 
 
1623
  'hits' => $this->cache_hits,
1624
  'misses' => $this->cache_misses,
1625
  'ratio' => $total > 0 ? round( $this->cache_hits / ( $total / 100 ), 1 ) : 100,
3
  * Plugin Name: Redis Object Cache Drop-In
4
  * Plugin URI: http://wordpress.org/plugins/redis-cache/
5
  * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Credis, HHVM, replication, clustering and WP-CLI.
6
+ * Version: 2.0.11
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
9
  * License: GPLv3
1379
  $start_time = microtime( true );
1380
 
1381
  try {
1382
+ $remaining_ids = array_map( function ( $key ) use ( $derived_keys ) {
1383
+ return $derived_keys[ $key ];
1384
+ }, $remaining_keys );
1385
+
1386
  $results = array_combine(
1387
  $remaining_keys,
1388
+ $this->redis->mget( $remaining_ids )
 
 
 
 
1389
  );
1390
  } catch ( Exception $exception ) {
1391
  $this->handle_exception( $exception );
1399
  $this->cache_time += $execute_time;
1400
 
1401
  foreach ( $results as $key => $value ) {
1402
+ if ( $value === null || $value === false ) {
1403
+ $cache[ $key ] = false;
 
 
1404
  $this->cache_misses++;
1405
  } else {
1406
+ $cache[ $key ] = $this->maybe_unserialize( $value );
1407
+ $this->add_to_internal_cache( $derived_keys[ $key ], $cache[ $key ] );
1408
 
1409
+ $this->cache_hits++;
1410
  }
1411
  }
1412
 
1619
  );
1620
 
1621
  return (object) [
1622
+ // Connected, Disabled, Unknown, Not connected
1623
+ 'status' => '...',
1624
  'hits' => $this->cache_hits,
1625
  'misses' => $this->cache_misses,
1626
  'ratio' => $total > 0 ? round( $this->cache_hits / ( $total / 100 ), 1 ) : 100,
includes/ui/diagnostics.php CHANGED
@@ -23,7 +23,9 @@ $info['Disabled'] = $disabled ? 'Yes' : 'No';
23
  $info['Filesystem'] = is_wp_error( $filesystem ) ? $filesystem->get_error_message() : 'Working';
24
 
25
  if ( $dropin && ! $disabled ) {
26
- $info[ 'Ping' ] = $wp_object_cache->diagnostics[ 'ping' ];
 
 
27
 
28
  try {
29
  $cache = new WP_Object_Cache( false );
23
  $info['Filesystem'] = is_wp_error( $filesystem ) ? $filesystem->get_error_message() : 'Working';
24
 
25
  if ( $dropin && ! $disabled ) {
26
+ $info[ 'Ping' ] = isset( $wp_object_cache->diagnostics[ 'ping' ] )
27
+ ? $wp_object_cache->diagnostics[ 'ping' ]
28
+ : false;
29
 
30
  try {
31
  $cache = new WP_Object_Cache( false );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: redis, predis, phpredis, credis, hhvm, pecl, caching, cache, object cache,
5
  Requires at least: 3.3
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.10
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -83,6 +83,11 @@ To see a list of all available WP-CLI commands, please see the [WP CLI commands
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
86
  = 2.0.10 =
87
 
88
  - Fixed unserializing values in `wp_cache_get_multiple()`
@@ -439,6 +444,6 @@ Since Predis isn't maintained any longer, it's highly recommended to switch over
439
 
440
  == Upgrade Notice ==
441
 
442
- = 2.0.10 =
443
 
444
  Version 2.0 is a significant rewrite of the plugin. Please read the v2.0.0 release notes.
5
  Requires at least: 3.3
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.11
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
83
 
84
  == Changelog ==
85
 
86
+ = 2.0.11 =
87
+
88
+ - Fixed an issue in `wp_cache_get_multiple()` when using Predis
89
+ - Prevent undefined index notice in diagnostics
90
+
91
  = 2.0.10 =
92
 
93
  - Fixed unserializing values in `wp_cache_get_multiple()`
444
 
445
  == Upgrade Notice ==
446
 
447
+ = 2.0.11 =
448
 
449
  Version 2.0 is a significant rewrite of the plugin. Please read the v2.0.0 release notes.
redis-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Redis Object Cache
4
  * Plugin URI: https://wordpress.org/plugins/redis-cache/
5
  * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Credis, HHVM, replication, clustering and WP-CLI.
6
- * Version: 2.0.10
7
  * Text Domain: redis-cache
8
  * Domain Path: /languages
9
  * Network: true
3
  * Plugin Name: Redis Object Cache
4
  * Plugin URI: https://wordpress.org/plugins/redis-cache/
5
  * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Credis, HHVM, replication, clustering and WP-CLI.
6
+ * Version: 2.0.11
7
  * Text Domain: redis-cache
8
  * Domain Path: /languages
9
  * Network: true