Redis Object Cache - Version 1.6.3

Version Description

Download this release

Release Info

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

Code changes from version 1.6.2 to 1.6.3

Files changed (3) hide show
  1. includes/object-cache.php +1 -1
  2. readme.txt +5 -1
  3. redis-cache.php +17 -10
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, HHVM, replication, clustering and WP-CLI.
6
- Version: 1.6.2
7
  Author: Till Krüss
8
  Author URI: https://till.im/
9
  License: GPLv3
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, HHVM, replication, clustering and WP-CLI.
6
+ Version: 1.6.3
7
  Author: Till Krüss
8
  Author URI: https://till.im/
9
  License: GPLv3
readme.txt CHANGED
@@ -95,7 +95,7 @@ To adjust the connection parameters, define any of the following constants in yo
95
  Amount of time in milliseconds to retry a failed connection attempt.
96
 
97
 
98
- == Configuration Parameters ==
99
 
100
  To adjust the configuration, define any of the following constants in your `wp-config.php` file.
101
 
@@ -143,6 +143,10 @@ To adjust the configuration, define any of the following constants in your `wp-c
143
 
144
  Set to `true` to disable promotions for [Redis Cache Pro](https://wprediscache.com/).
145
 
 
 
 
 
146
  == Replication & Clustering ==
147
 
148
  To use Replication, Sharding or Clustering, make sure your server is running PHP7 or higher (HHVM is not supported) and you consulted the [Predis](https://github.com/nrk/predis) or [PhpRedis](https://github.com/phpredis/phpredis) documentation.
95
  Amount of time in milliseconds to retry a failed connection attempt.
96
 
97
 
98
+ == Configuration Options ==
99
 
100
  To adjust the configuration, define any of the following constants in your `wp-config.php` file.
101
 
143
 
144
  Set to `true` to disable promotions for [Redis Cache Pro](https://wprediscache.com/).
145
 
146
+ * `WP_REDIS_DISABLE_COMMENT` (default: _not set_)
147
+
148
+ Set to `true` to disable the HTML footer comment and it's optional debugging information when `WP_DEBUG` is enabled.
149
+
150
  == Replication & Clustering ==
151
 
152
  To use Replication, Sharding or Clustering, make sure your server is running PHP7 or higher (HHVM is not supported) and you consulted the [Predis](https://github.com/nrk/predis) or [PhpRedis](https://github.com/phpredis/phpredis) documentation.
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, HHVM, replication, clustering and WP-CLI.
6
- Version: 1.6.2
7
  Text Domain: redis-cache
8
  Domain Path: /languages
9
  Author: Till Krüss
@@ -49,7 +49,7 @@ class RedisObjectCache {
49
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
50
  add_action( 'load-' . $this->screen, array( $this, 'do_admin_actions' ) );
51
  add_action( 'load-' . $this->screen, array( $this, 'add_admin_page_notices' ) );
52
- add_action( 'shutdown', array( $this, 'maybe_print_comment' ), 0 );
53
  add_action( 'wp_ajax_roc_dismiss_notice', array( $this, 'dismiss_notice' ) );
54
 
55
  add_filter( sprintf(
@@ -478,16 +478,15 @@ class RedisObjectCache {
478
  );
479
  }
480
 
481
- public function maybe_print_comment() {
482
- global $wp_object_cache;
483
-
484
- if ( defined( 'WP_REDIS_DISABLE_COMMENT' ) && WP_REDIS_DISABLE_COMMENT ) {
485
- return;
486
  }
 
487
 
488
- if ( ! defined( 'WP_USE_THEMES' ) || ! WP_USE_THEMES ) {
489
- return;
490
- }
491
 
492
  if (
493
  ( defined( 'DOING_CRON' ) && DOING_CRON ) ||
@@ -505,6 +504,14 @@ class RedisObjectCache {
505
  return;
506
  }
507
 
 
 
 
 
 
 
 
 
508
  $message = sprintf(
509
  __( 'Performance optimized by Redis Object Cache. Learn more: %s', 'redis-cache' ),
510
  'https://wprediscache.com'
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, HHVM, replication, clustering and WP-CLI.
6
+ Version: 1.6.3
7
  Text Domain: redis-cache
8
  Domain Path: /languages
9
  Author: Till Krüss
49
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
50
  add_action( 'load-' . $this->screen, array( $this, 'do_admin_actions' ) );
51
  add_action( 'load-' . $this->screen, array( $this, 'add_admin_page_notices' ) );
52
+ add_action( 'wp_head', array( $this, 'register_shutdown_hooks' ) );
53
  add_action( 'wp_ajax_roc_dismiss_notice', array( $this, 'dismiss_notice' ) );
54
 
55
  add_filter( sprintf(
478
  );
479
  }
480
 
481
+ public function register_shutdown_hooks()
482
+ {
483
+ if ( ! defined( 'WP_REDIS_DISABLE_COMMENT' ) || ! WP_REDIS_DISABLE_COMMENT ) {
484
+ add_action( 'shutdown', array( $this, 'maybe_print_comment' ), 0 );
 
485
  }
486
+ }
487
 
488
+ public function maybe_print_comment() {
489
+ global $wp_object_cache;
 
490
 
491
  if (
492
  ( defined( 'DOING_CRON' ) && DOING_CRON ) ||
504
  return;
505
  }
506
 
507
+ if (
508
+ ! isset( $wp_object_cache->cache_hits ) ||
509
+ ! isset( $wp_object_cache->redis_client ) ||
510
+ ! is_array( $wp_object_cache->cache )
511
+ ) {
512
+ return;
513
+ }
514
+
515
  $message = sprintf(
516
  __( 'Performance optimized by Redis Object Cache. Learn more: %s', 'redis-cache' ),
517
  'https://wprediscache.com'