Redis Object Cache - Version 2.0.17

Version Description

  • Code cleanup
  • Fixed missing metrics
  • Fixed filesystem test
Download this release

Release Info

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

Code changes from version 2.0.16 to 2.0.17

assets/js/admin.js CHANGED
@@ -5,14 +5,6 @@
5
  $.extend( rediscache, {
6
  metrics: {
7
  computed: null,
8
- names: {
9
- h: 'hits',
10
- m: 'misses',
11
- r: 'ratio',
12
- b: 'bytes',
13
- t: 'time',
14
- c: 'calls',
15
- },
16
  },
17
  chart: null,
18
  chart_defaults: {
@@ -228,24 +220,20 @@
228
  },
229
  } );
230
 
231
- var compute_metrics = function ( raw_metrics, metric_names ) {
232
  var metrics = {};
233
 
234
  // parse raw metrics in blocks of minutes
235
  for ( var entry in raw_metrics ) {
236
  var values = {};
237
- var timestamp = raw_metrics[ entry ];
238
  var minute = ( timestamp - timestamp % 60 ) * 1000;
239
 
240
- entry.split( ';' ).forEach(
241
- function ( value ) {
242
- var metric = value.split( '=' );
243
-
244
- if ( metric_names[ metric[0] ] ) {
245
- values[ metric_names[ metric[0] ] ] = Number( metric[1] );
246
- }
247
  }
248
- );
249
 
250
  if ( ! metrics[ minute ] ) {
251
  metrics[ minute ] = [];
@@ -263,16 +251,14 @@
263
 
264
  var medians = {};
265
 
266
- for ( var key in metric_names ) {
267
- var name = metric_names[ key ];
268
-
269
- medians[ name ] = compute_median(
270
  metrics[ entry ].map(
271
  function ( metric ) {
272
- return metric[ name ];
273
  }
274
  )
275
- )
276
  }
277
 
278
  metrics[ entry ] = medians;
@@ -420,10 +406,7 @@
420
  $( window ).on( 'hashchange', show_current_tab );
421
 
422
  if ( $( '#widget-redis-stats' ).length ) {
423
- rediscache.metrics.computed = compute_metrics(
424
- root.rediscache_metrics,
425
- rediscache.metrics.names
426
- );
427
 
428
  setup_charts();
429
  render_chart( 'time' );
5
  $.extend( rediscache, {
6
  metrics: {
7
  computed: null,
 
 
 
 
 
 
 
 
8
  },
9
  chart: null,
10
  chart_defaults: {
220
  },
221
  } );
222
 
223
+ var compute_metrics = function ( raw_metrics ) {
224
  var metrics = {};
225
 
226
  // parse raw metrics in blocks of minutes
227
  for ( var entry in raw_metrics ) {
228
  var values = {};
229
+ var timestamp = raw_metrics[ entry ].timestamp;
230
  var minute = ( timestamp - timestamp % 60 ) * 1000;
231
 
232
+ for ( var key in raw_metrics[ entry ] ) {
233
+ if ( raw_metrics[ entry ].hasOwnProperty( key ) ) {
234
+ values[ key ] = Number( raw_metrics[ entry ][ key ] );
 
 
 
 
235
  }
236
+ }
237
 
238
  if ( ! metrics[ minute ] ) {
239
  metrics[ minute ] = [];
251
 
252
  var medians = {};
253
 
254
+ for ( var key in metrics[ entry ][0] ) {
255
+ medians[ key ] = compute_median(
 
 
256
  metrics[ entry ].map(
257
  function ( metric ) {
258
+ return metric[ key ];
259
  }
260
  )
261
+ );
262
  }
263
 
264
  metrics[ entry ] = medians;
406
  $( window ).on( 'hashchange', show_current_tab );
407
 
408
  if ( $( '#widget-redis-stats' ).length ) {
409
+ rediscache.metrics.computed = compute_metrics( root.rediscache_metrics );
 
 
 
410
 
411
  setup_charts();
412
  render_chart( 'time' );
dependencies/colinmollenhour/credis/testenv/env/php-5.5/Dockerfile DELETED
@@ -1,24 +0,0 @@
1
- FROM php:5.5
2
- ENV phpunit_verison 4.8
3
- ENV redis_version 4.0.11
4
-
5
- RUN apt-get update && \
6
- apt-get install -y wget
7
-
8
- RUN wget https://phar.phpunit.de/phpunit-${phpunit_verison}.phar && \
9
- chmod +x phpunit-${phpunit_verison}.phar && \
10
- mv phpunit-${phpunit_verison}.phar /usr/local/bin/phpunit
11
-
12
- # install php extension
13
- RUN yes '' | pecl install -f redis && \
14
- docker-php-ext-enable redis
15
-
16
- # install redis server
17
- RUN wget http://download.redis.io/releases/redis-${redis_version}.tar.gz && \
18
- tar -xzf redis-${redis_version}.tar.gz && \
19
- make -s -C redis-${redis_version} -j
20
-
21
- CMD PATH=$PATH:/usr/local/bin/:/redis-${redis_version}/src/ && \
22
- cp -rp /src /app && \
23
- cd /app && \
24
- phpunit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/class-metrics.php CHANGED
@@ -129,8 +129,6 @@ class Metrics {
129
  * @return void
130
  */
131
  public static function record() {
132
- global $wp_object_cache;
133
-
134
  if ( ! self::is_active() ) {
135
  return;
136
  }
@@ -176,7 +174,7 @@ class Metrics {
176
  }
177
 
178
  try {
179
- $serialied_metrics = $wp_object_cache->redis_instance()->zrangebyscore(
180
  $wp_object_cache->build_key( 'metrics', 'redis-cache' ),
181
  time() - $seconds,
182
  time() - MINUTE_IN_SECONDS,
@@ -192,7 +190,7 @@ class Metrics {
192
  $metrics = [];
193
  $prefix = sprintf( 'O:%d:"%s', strlen( self::class ), self::class );
194
 
195
- foreach ( $serialied_metrics as $serialized => $timestamp ) {
196
  // Compatibility: Ignore all non serialized entries as they were used by prior versions.
197
  if ( strpos( $serialized, $prefix ) !== 0 ) {
198
  continue;
129
  * @return void
130
  */
131
  public static function record() {
 
 
132
  if ( ! self::is_active() ) {
133
  return;
134
  }
174
  }
175
 
176
  try {
177
+ $raw_metrics = $wp_object_cache->redis_instance()->zrangebyscore(
178
  $wp_object_cache->build_key( 'metrics', 'redis-cache' ),
179
  time() - $seconds,
180
  time() - MINUTE_IN_SECONDS,
190
  $metrics = [];
191
  $prefix = sprintf( 'O:%d:"%s', strlen( self::class ), self::class );
192
 
193
+ foreach ( $raw_metrics as $serialized => $timestamp ) {
194
  // Compatibility: Ignore all non serialized entries as they were used by prior versions.
195
  if ( strpos( $serialized, $prefix ) !== 0 ) {
196
  continue;
includes/class-plugin.php CHANGED
@@ -580,7 +580,7 @@ class Plugin {
580
  if ( ! current_user_can( is_multisite() ? 'manage_network_options' : 'manage_options' ) ) {
581
  return;
582
  }
583
-
584
  // Do not display the dropin message if you want
585
  if ( defined( 'WP_REDIS_DISABLE_DROPIN_BANNERS' ) && WP_REDIS_DISABLE_DROPIN_BANNERS ) {
586
  return;
580
  if ( ! current_user_can( is_multisite() ? 'manage_network_options' : 'manage_options' ) ) {
581
  return;
582
  }
583
+
584
  // Do not display the dropin message if you want
585
  if ( defined( 'WP_REDIS_DISABLE_DROPIN_BANNERS' ) && WP_REDIS_DISABLE_DROPIN_BANNERS ) {
586
  return;
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.15
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
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, Credis, HHVM, replication, clustering and WP-CLI.
6
+ * Version: 2.0.17
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
9
  * License: GPLv3
includes/ui/diagnostics.php CHANGED
@@ -16,11 +16,12 @@ $disabled = defined( 'WP_REDIS_DISABLED' ) && WP_REDIS_DISABLED;
16
 
17
  $info['Status'] = $roc->get_status();
18
  $info['Client'] = $roc->get_redis_client_name();
 
19
  $info['Drop-in'] = $roc->object_cache_dropin_exists()
20
  ? ( $dropin ? 'Valid' : 'Invalid' )
21
  : 'Not installed';
 
22
  $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' ] = isset( $wp_object_cache->diagnostics[ 'ping' ] )
@@ -56,6 +57,8 @@ $info['Redis Version'] = $roc->get_redis_version() ?: 'Unknown';
56
 
57
  $info['Multisite'] = is_multisite() ? 'Yes' : 'No';
58
 
 
 
59
  if ( $dropin ) {
60
  $info['Global Prefix'] = wp_json_encode( $wp_object_cache->global_prefix );
61
  $info['Blog Prefix'] = wp_json_encode( $wp_object_cache->blog_prefix );
16
 
17
  $info['Status'] = $roc->get_status();
18
  $info['Client'] = $roc->get_redis_client_name();
19
+
20
  $info['Drop-in'] = $roc->object_cache_dropin_exists()
21
  ? ( $dropin ? 'Valid' : 'Invalid' )
22
  : 'Not installed';
23
+
24
  $info['Disabled'] = $disabled ? 'Yes' : 'No';
 
25
 
26
  if ( $dropin && ! $disabled ) {
27
  $info[ 'Ping' ] = isset( $wp_object_cache->diagnostics[ 'ping' ] )
57
 
58
  $info['Multisite'] = is_multisite() ? 'Yes' : 'No';
59
 
60
+ $info['Filesystem'] = is_wp_error( $filesystem ) ? $filesystem->get_error_message() : 'Working';
61
+
62
  if ( $dropin ) {
63
  $info['Global Prefix'] = wp_json_encode( $wp_object_cache->global_prefix );
64
  $info['Blog Prefix'] = wp_json_encode( $wp_object_cache->blog_prefix );
languages/redis-cache.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the GPLv3.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Redis Object Cache 2.0.16\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/redis-cache\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-12-25T02:24:58+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: redis-cache\n"
2
  # This file is distributed under the GPLv3.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Redis Object Cache 2.0.17\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/redis-cache\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-12-27T00:13:47+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: redis-cache\n"
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: tillkruess
3
  Donate link: https://github.com/sponsors/tillkruss
4
  Tags: redis, predis, phpredis, credis, hhvm, pecl, caching, cache, object cache, performance, replication, clustering, keydb
5
  Requires at least: 3.3
6
- Tested up to: 5.6
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.16
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -83,6 +83,12 @@ To see a list of all available WP-CLI commands, please see the [WP CLI commands
83
 
84
  == Changelog ==
85
 
 
 
 
 
 
 
86
  = 2.0.16 =
87
 
88
  - Updated Credis to v1.11.4
@@ -484,6 +490,6 @@ Since Predis isn't maintained any longer, it's highly recommended to switch over
484
 
485
  == Upgrade Notice ==
486
 
487
- = 2.0.16 =
488
 
489
  Version 2.0 is a significant rewrite of the plugin. Please read the v2.0.0 release notes.
3
  Donate link: https://github.com/sponsors/tillkruss
4
  Tags: redis, predis, phpredis, credis, hhvm, pecl, caching, cache, object cache, performance, replication, clustering, keydb
5
  Requires at least: 3.3
6
+ Tested up to: 5.7
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.17
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
83
 
84
  == Changelog ==
85
 
86
+ = 2.0.17 =
87
+
88
+ - Code cleanup
89
+ - Fixed missing metrics
90
+ - Fixed filesystem test
91
+
92
  = 2.0.16 =
93
 
94
  - Updated Credis to v1.11.4
490
 
491
  == Upgrade Notice ==
492
 
493
+ = 2.0.17 =
494
 
495
  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.16
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.17
7
  * Text Domain: redis-cache
8
  * Domain Path: /languages
9
  * Network: true