Redis Object Cache - Version 2.0.21

Version Description

  • Added metrics diagnostics
  • Added WP_Object_Cache::decr() alias
  • Moved diagnostics.php file
Download this release

Release Info

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

Code changes from version 2.0.20 to 2.0.21

includes/class-metrics.php CHANGED
@@ -248,4 +248,26 @@ class Metrics {
248
  }
249
  }
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
  }
248
  }
249
  }
250
 
251
+ /**
252
+ * Counts the recorded metrics
253
+ *
254
+ * @return int
255
+ */
256
+ public static function count() {
257
+ global $wp_object_cache;
258
+
259
+ if ( ! self::is_active() ) {
260
+ return;
261
+ }
262
+
263
+ try {
264
+ return $wp_object_cache->redis_instance()->zcount(
265
+ $wp_object_cache->build_key( 'metrics', 'redis-cache' ), '-inf', '+inf'
266
+ );
267
+ } catch ( Exception $exception ) {
268
+ // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
269
+ error_log( $exception );
270
+ }
271
+ }
272
+
273
  }
includes/cli/class-commands.php CHANGED
@@ -33,7 +33,7 @@ class Commands extends WP_CLI_Command {
33
  public function status() {
34
  $roc = Plugin::instance();
35
 
36
- require_once __DIR__ . '/../ui/diagnostics.php';
37
  }
38
 
39
  /**
33
  public function status() {
34
  $roc = Plugin::instance();
35
 
36
+ require_once __DIR__ . '/../diagnostics.php';
37
  }
38
 
39
  /**
includes/{ui/diagnostics.php → diagnostics.php} RENAMED
@@ -57,6 +57,9 @@ $info['Redis Version'] = $roc->get_redis_version() ?: 'Unknown';
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 ) {
57
 
58
  $info['Multisite'] = is_multisite() ? 'Yes' : 'No';
59
 
60
+ $info['Metrics'] = \Rhubarb\RedisCache\Metrics::is_active() ? 'Enabled' : 'Disabled';
61
+ $info['Metrics recorded'] = wp_json_encode( \Rhubarb\RedisCache\Metrics::count() );
62
+
63
  $info['Filesystem'] = is_wp_error( $filesystem ) ? $filesystem->get_error_message() : 'Working';
64
 
65
  if ( $dropin ) {
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.20
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
9
  * License: GPLv3
@@ -1935,6 +1935,19 @@ LUA;
1935
  return $result;
1936
  }
1937
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1938
  /**
1939
  * Render data about current cache requests
1940
  * Used by the Debug bar plugin
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.21
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
9
  * License: GPLv3
1935
  return $result;
1936
  }
1937
 
1938
+ /**
1939
+ * Alias of `decrement()`.
1940
+ *
1941
+ * @see self::decrement()
1942
+ * @param string $key The key name.
1943
+ * @param int $offset Optional. The decrement. Defaults to 1.
1944
+ * @param string $group Optional. The key group. Default is 'default'.
1945
+ * @return int|bool
1946
+ */
1947
+ public function decr( $key, $offset = 1, $group = 'default' ) {
1948
+ return $this->decrement( $key, $offset, $group );
1949
+ }
1950
+
1951
  /**
1952
  * Render data about current cache requests
1953
  * Used by the Debug bar plugin
includes/ui/tabs/diagnostics.php CHANGED
@@ -10,5 +10,5 @@ defined( '\\ABSPATH' ) || exit;
10
  ?>
11
 
12
  <p>
13
- <textarea class="large-text readonly" rows="20" readonly><?php require dirname( __DIR__ ) . '/diagnostics.php'; ?></textarea>
14
  </p>
10
  ?>
11
 
12
  <p>
13
+ <textarea class="large-text readonly" rows="20" readonly><?php require dirname( __DIR__ ) . '/../diagnostics.php'; ?></textarea>
14
  </p>
languages/redis-cache.pot CHANGED
@@ -1,17 +1,17 @@
1
- # Copyright (C) 2020 Till Krüss
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"
16
 
17
  #. Plugin Name of the plugin
@@ -187,35 +187,35 @@ msgid "Object Cache Pro is a <u>business class</u> object cache that’s highly-
187
  msgstr ""
188
 
189
  #. translators: %1$d = number of objects. %2$s = human-readable size of cache. %3$s = name of the used client.
190
- #: includes/class-plugin.php:907
191
  msgid "Retrieved %1$d objects (%2$s) from Redis using %3$s."
192
  msgstr ""
193
 
194
- #: includes/class-plugin.php:964
195
  msgid "Could not initialize filesystem."
196
  msgstr ""
197
 
198
- #: includes/class-plugin.php:971
199
  msgid "Object cache file doesn’t exist."
200
  msgstr ""
201
 
202
- #: includes/class-plugin.php:976
203
  msgid "Test file exists, but couldn’t be deleted."
204
  msgstr ""
205
 
206
- #: includes/class-plugin.php:981
207
  msgid "Failed to copy test file."
208
  msgstr ""
209
 
210
- #: includes/class-plugin.php:985
211
  msgid "Copied test file doesn’t exist."
212
  msgstr ""
213
 
214
- #: includes/class-plugin.php:991
215
  msgid "Couldn’t verify test file contents."
216
  msgstr ""
217
 
218
- #: includes/class-plugin.php:995
219
  msgid "Copied test file couldn’t be deleted."
220
  msgstr ""
221
 
1
+ # Copyright (C) 2021 Till Krüss
2
  # This file is distributed under the GPLv3.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Redis Object Cache 2.0.21\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: 2021-07-20T19:15:25+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
+ "X-Generator: WP-CLI 2.5.0\n"
15
  "X-Domain: redis-cache\n"
16
 
17
  #. Plugin Name of the plugin
187
  msgstr ""
188
 
189
  #. translators: %1$d = number of objects. %2$s = human-readable size of cache. %3$s = name of the used client.
190
+ #: includes/class-plugin.php:908
191
  msgid "Retrieved %1$d objects (%2$s) from Redis using %3$s."
192
  msgstr ""
193
 
194
+ #: includes/class-plugin.php:965
195
  msgid "Could not initialize filesystem."
196
  msgstr ""
197
 
198
+ #: includes/class-plugin.php:972
199
  msgid "Object cache file doesn’t exist."
200
  msgstr ""
201
 
202
+ #: includes/class-plugin.php:977
203
  msgid "Test file exists, but couldn’t be deleted."
204
  msgstr ""
205
 
206
+ #: includes/class-plugin.php:982
207
  msgid "Failed to copy test file."
208
  msgstr ""
209
 
210
+ #: includes/class-plugin.php:986
211
  msgid "Copied test file doesn’t exist."
212
  msgstr ""
213
 
214
+ #: includes/class-plugin.php:992
215
  msgid "Couldn’t verify test file contents."
216
  msgstr ""
217
 
218
+ #: includes/class-plugin.php:996
219
  msgid "Copied test file couldn’t be deleted."
220
  msgstr ""
221
 
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.8
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.20
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.20 =
87
 
88
  - Fix wp.org release
@@ -506,6 +512,6 @@ Since Predis isn't maintained any longer, it's highly recommended to switch over
506
 
507
  == Upgrade Notice ==
508
 
509
- = 2.0.18 =
510
 
511
  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.8
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.21
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
83
 
84
  == Changelog ==
85
 
86
+ = 2.0.21 =
87
+
88
+ - Added metrics diagnostics
89
+ - Added `WP_Object_Cache::decr()` alias
90
+ - Moved `diagnostics.php` file
91
+
92
  = 2.0.20 =
93
 
94
  - Fix wp.org release
512
 
513
  == Upgrade Notice ==
514
 
515
+ = 2.0.21 =
516
 
517
  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.20
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.21
7
  * Text Domain: redis-cache
8
  * Domain Path: /languages
9
  * Network: true