Redis Object Cache - Version 2.2.2

Version Description

  • Use QM_Data_Cache instead of QM_Data
  • Fixed WP_Error use statement non-compound name warning
Download this release

Release Info

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

Code changes from version 2.2.1 to 2.2.2

includes/class-qm-collector.php CHANGED
@@ -7,14 +7,16 @@
7
 
8
  namespace Rhubarb\RedisCache;
9
 
10
- use QM_Collector as Base_Collector;
 
 
11
 
12
  defined( '\\ABSPATH' ) || exit;
13
 
14
  /**
15
  * Query Monitor data collector class definition
16
  */
17
- class QM_Collector extends Base_Collector {
18
 
19
  /**
20
  * Collector id
@@ -32,6 +34,15 @@ class QM_Collector extends Base_Collector {
32
  return __( 'Object Cache', 'redis-cache' );
33
  }
34
 
 
 
 
 
 
 
 
 
 
35
  /**
36
  * Fills the collector with data
37
  *
@@ -75,7 +86,7 @@ class QM_Collector extends Base_Collector {
75
  // These are used by Query Monitor
76
  $this->data['cache_hit_percentage'] = $info->ratio;
77
 
78
- if ( $this->data instanceof \QM_Data ) {
79
  $this->data->stats['cache_hits'] = $info->hits;
80
  $this->data->stats['cache_misses'] = $info->misses;
81
  } else {
@@ -104,10 +115,11 @@ class QM_Collector extends Base_Collector {
104
  $this->data['object_cache_extensions'] = array_map(
105
  'extension_loaded',
106
  [
107
- 'APCu' => 'APCu',
108
- 'Memcache' => 'Memcache',
109
- 'Memcached' => 'Memcached',
110
- 'Redis' => 'Redis',
 
111
  ]
112
  );
113
 
7
 
8
  namespace Rhubarb\RedisCache;
9
 
10
+ use QM_Data;
11
+ use QM_Data_Cache;
12
+ use QM_Collector as QM_BaseCollector;
13
 
14
  defined( '\\ABSPATH' ) || exit;
15
 
16
  /**
17
  * Query Monitor data collector class definition
18
  */
19
+ class QM_Collector extends QM_BaseCollector {
20
 
21
  /**
22
  * Collector id
34
  return __( 'Object Cache', 'redis-cache' );
35
  }
36
 
37
+ /**
38
+ * The collector storage
39
+ *
40
+ * @return \QM_Data
41
+ */
42
+ public function get_storage(): QM_Data {
43
+ return new QM_Data_Cache;
44
+ }
45
+
46
  /**
47
  * Fills the collector with data
48
  *
86
  // These are used by Query Monitor
87
  $this->data['cache_hit_percentage'] = $info->ratio;
88
 
89
+ if ( $this->data instanceof QM_Data_Cache ) {
90
  $this->data->stats['cache_hits'] = $info->hits;
91
  $this->data->stats['cache_misses'] = $info->misses;
92
  } else {
115
  $this->data['object_cache_extensions'] = array_map(
116
  'extension_loaded',
117
  [
118
+ 'APCu' => 'apcu',
119
+ 'Redis' => 'redis',
120
+ 'Relay' => 'relay',
121
+ 'Memcache' => 'memcache',
122
+ 'Memcached' => 'memcached',
123
  ]
124
  );
125
 
includes/object-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Redis Object Cache Drop-In
4
  * Plugin URI: https://wordpress.org/plugins/redis-cache/
5
  * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
6
- * Version: 2.2.1
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
9
  * License: GPLv3
@@ -29,18 +29,18 @@ if ( ! defined( 'WP_REDIS_DISABLED' ) || ! WP_REDIS_DISABLED ) :
29
  * @return bool True if the feature is supported, false otherwise.
30
  */
31
  function wp_cache_supports( $feature ) {
32
- switch ( $feature ) {
33
- case 'add_multiple':
34
- case 'set_multiple':
35
- case 'get_multiple':
36
- case 'delete_multiple':
37
- case 'flush_runtime':
38
- return true;
39
 
40
  case 'flush_group':
41
- default:
42
- return false;
43
- }
44
  }
45
 
46
 
3
  * Plugin Name: Redis Object Cache Drop-In
4
  * Plugin URI: https://wordpress.org/plugins/redis-cache/
5
  * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
6
+ * Version: 2.2.2
7
  * Author: Till Krüss
8
  * Author URI: https://objectcache.pro
9
  * License: GPLv3
29
  * @return bool True if the feature is supported, false otherwise.
30
  */
31
  function wp_cache_supports( $feature ) {
32
+ switch ( $feature ) {
33
+ case 'add_multiple':
34
+ case 'set_multiple':
35
+ case 'get_multiple':
36
+ case 'delete_multiple':
37
+ case 'flush_runtime':
38
+ return true;
39
 
40
  case 'flush_group':
41
+ default:
42
+ return false;
43
+ }
44
  }
45
 
46
 
includes/ui/tabs/overview.php CHANGED
@@ -7,8 +7,6 @@
7
 
8
  defined( '\\ABSPATH' ) || exit;
9
 
10
- use WP_Error;
11
-
12
  /** @var \Rhubarb\RedisCache\Plugin $roc */
13
  $status = $roc->get_redis_status();
14
  $redis_client = $roc->get_redis_client_name();
@@ -73,7 +71,7 @@ $diagnostics = $roc->get_diagnostics();
73
  <tr>
74
  <th><?php esc_html_e( 'Filesystem:', 'redis-cache' ); ?></th>
75
  <td>
76
- <?php if ( $roc->test_filesystem_writing() instanceof WP_Error ) : ?>
77
  <span class="error">
78
  <span class="dashicons dashicons-no"></span>
79
  <?php esc_html_e( 'Not writeable', 'redis-cache' ); ?>
7
 
8
  defined( '\\ABSPATH' ) || exit;
9
 
 
 
10
  /** @var \Rhubarb\RedisCache\Plugin $roc */
11
  $status = $roc->get_redis_status();
12
  $redis_client = $roc->get_redis_client_name();
71
  <tr>
72
  <th><?php esc_html_e( 'Filesystem:', 'redis-cache' ); ?></th>
73
  <td>
74
+ <?php if ( $roc->test_filesystem_writing() instanceof \WP_Error ) : ?>
75
  <span class="error">
76
  <span class="dashicons dashicons-no"></span>
77
  <?php esc_html_e( 'Not writeable', 'redis-cache' ); ?>
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.2.1\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: 2022-10-31T01:02:46+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: redis-cache\n"
@@ -42,7 +42,7 @@ msgid "Redis"
42
  msgstr ""
43
 
44
  #: includes/class-plugin.php:178
45
- #: includes/ui/tabs/overview.php:24
46
  msgid "Overview"
47
  msgstr ""
48
 
@@ -97,7 +97,7 @@ msgid "Enable object cache to collect data."
97
  msgstr ""
98
 
99
  #: includes/class-plugin.php:483
100
- #: includes/class-qm-collector.php:66
101
  msgid "Disabled"
102
  msgstr ""
103
 
@@ -118,7 +118,7 @@ msgid "Not connected"
118
  msgstr ""
119
 
120
  #: includes/class-plugin.php:500
121
- #: includes/ui/tabs/overview.php:272
122
  msgid "Unknown"
123
  msgstr ""
124
 
@@ -225,12 +225,12 @@ msgstr ""
225
  msgid "Copied test file couldn’t be deleted."
226
  msgstr ""
227
 
228
- #: includes/class-qm-collector.php:32
229
  msgid "Object Cache"
230
  msgstr ""
231
 
232
- #: includes/class-qm-collector.php:66
233
- #: includes/ui/tabs/overview.php:94
234
  msgid "Yes"
235
  msgstr ""
236
 
@@ -394,133 +394,133 @@ msgstr ""
394
  msgid "The total amount of commands sent to Redis."
395
  msgstr ""
396
 
397
- #: includes/ui/tabs/overview.php:30
398
  msgid "Status:"
399
  msgstr ""
400
 
401
- #: includes/ui/tabs/overview.php:47
402
  msgid "Drop-in:"
403
  msgstr ""
404
 
405
- #: includes/ui/tabs/overview.php:52
406
  msgid "Not installed"
407
  msgstr ""
408
 
409
- #: includes/ui/tabs/overview.php:57
410
  msgid "Outdated"
411
  msgstr ""
412
 
413
- #: includes/ui/tabs/overview.php:62
414
  msgid "Valid"
415
  msgstr ""
416
 
417
- #: includes/ui/tabs/overview.php:67
418
  msgid "Invalid"
419
  msgstr ""
420
 
421
- #: includes/ui/tabs/overview.php:74
422
  msgid "Filesystem:"
423
  msgstr ""
424
 
425
- #: includes/ui/tabs/overview.php:79
426
  msgid "Not writeable"
427
  msgstr ""
428
 
429
- #: includes/ui/tabs/overview.php:84
430
  msgid "Writeable"
431
  msgstr ""
432
 
433
- #: includes/ui/tabs/overview.php:92
434
  msgid "Disabled:"
435
  msgstr ""
436
 
437
- #: includes/ui/tabs/overview.php:101
438
  msgid "Key Prefix:"
439
  msgstr ""
440
 
441
- #: includes/ui/tabs/overview.php:110
442
  msgid "Max. TTL:"
443
  msgstr ""
444
 
445
- #: includes/ui/tabs/overview.php:116
446
  msgid "This doesn’t appear to be a valid number."
447
  msgstr ""
448
 
449
- #: includes/ui/tabs/overview.php:128
450
  msgid "Connection"
451
  msgstr ""
452
 
453
- #: includes/ui/tabs/overview.php:135
454
  msgid "Client:"
455
  msgstr ""
456
 
457
- #: includes/ui/tabs/overview.php:144
458
  msgid "Host:"
459
  msgstr ""
460
 
461
- #: includes/ui/tabs/overview.php:151
462
  msgid "Cluster:"
463
  msgstr ""
464
 
465
- #: includes/ui/tabs/overview.php:164
466
  msgid "Shards:"
467
  msgstr ""
468
 
469
- #: includes/ui/tabs/overview.php:177
470
  msgid "Servers:"
471
  msgstr ""
472
 
473
- #: includes/ui/tabs/overview.php:190
474
  msgid "Port:"
475
  msgstr ""
476
 
477
- #: includes/ui/tabs/overview.php:197
478
  msgid "Username:"
479
  msgstr ""
480
 
481
- #: includes/ui/tabs/overview.php:204
482
  msgid "Password:"
483
  msgstr ""
484
 
485
- #: includes/ui/tabs/overview.php:213
486
  msgid "Database:"
487
  msgstr ""
488
 
489
- #: includes/ui/tabs/overview.php:220
490
  msgid "Connection Timeout:"
491
  msgstr ""
492
 
493
  #. translators: %s = Redis connection/read timeout in seconds.
494
- #: includes/ui/tabs/overview.php:226
495
- #: includes/ui/tabs/overview.php:243
496
  msgid "%ss"
497
  msgstr ""
498
 
499
- #: includes/ui/tabs/overview.php:237
500
  msgid "Read Timeout:"
501
  msgstr ""
502
 
503
- #: includes/ui/tabs/overview.php:254
504
  msgid "Retry Interval:"
505
  msgstr ""
506
 
507
  #. translators: %s = Redis retry interval in milliseconds.
508
- #: includes/ui/tabs/overview.php:260
509
  msgid "%sms"
510
  msgstr ""
511
 
512
- #: includes/ui/tabs/overview.php:271
513
  msgid "Redis Version:"
514
  msgstr ""
515
 
516
- #: includes/ui/tabs/overview.php:284
517
  msgid "Flush Cache"
518
  msgstr ""
519
 
520
- #: includes/ui/tabs/overview.php:290
521
  msgid "Disable Object Cache"
522
  msgstr ""
523
 
524
- #: includes/ui/tabs/overview.php:294
525
  msgid "Enable Object Cache"
526
  msgstr ""
2
  # This file is distributed under the GPLv3.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Redis Object Cache 2.2.2\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: 2022-11-05T23:18:33+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.6.0\n"
15
  "X-Domain: redis-cache\n"
42
  msgstr ""
43
 
44
  #: includes/class-plugin.php:178
45
+ #: includes/ui/tabs/overview.php:22
46
  msgid "Overview"
47
  msgstr ""
48
 
97
  msgstr ""
98
 
99
  #: includes/class-plugin.php:483
100
+ #: includes/class-qm-collector.php:77
101
  msgid "Disabled"
102
  msgstr ""
103
 
118
  msgstr ""
119
 
120
  #: includes/class-plugin.php:500
121
+ #: includes/ui/tabs/overview.php:270
122
  msgid "Unknown"
123
  msgstr ""
124
 
225
  msgid "Copied test file couldn’t be deleted."
226
  msgstr ""
227
 
228
+ #: includes/class-qm-collector.php:34
229
  msgid "Object Cache"
230
  msgstr ""
231
 
232
+ #: includes/class-qm-collector.php:77
233
+ #: includes/ui/tabs/overview.php:92
234
  msgid "Yes"
235
  msgstr ""
236
 
394
  msgid "The total amount of commands sent to Redis."
395
  msgstr ""
396
 
397
+ #: includes/ui/tabs/overview.php:28
398
  msgid "Status:"
399
  msgstr ""
400
 
401
+ #: includes/ui/tabs/overview.php:45
402
  msgid "Drop-in:"
403
  msgstr ""
404
 
405
+ #: includes/ui/tabs/overview.php:50
406
  msgid "Not installed"
407
  msgstr ""
408
 
409
+ #: includes/ui/tabs/overview.php:55
410
  msgid "Outdated"
411
  msgstr ""
412
 
413
+ #: includes/ui/tabs/overview.php:60
414
  msgid "Valid"
415
  msgstr ""
416
 
417
+ #: includes/ui/tabs/overview.php:65
418
  msgid "Invalid"
419
  msgstr ""
420
 
421
+ #: includes/ui/tabs/overview.php:72
422
  msgid "Filesystem:"
423
  msgstr ""
424
 
425
+ #: includes/ui/tabs/overview.php:77
426
  msgid "Not writeable"
427
  msgstr ""
428
 
429
+ #: includes/ui/tabs/overview.php:82
430
  msgid "Writeable"
431
  msgstr ""
432
 
433
+ #: includes/ui/tabs/overview.php:90
434
  msgid "Disabled:"
435
  msgstr ""
436
 
437
+ #: includes/ui/tabs/overview.php:99
438
  msgid "Key Prefix:"
439
  msgstr ""
440
 
441
+ #: includes/ui/tabs/overview.php:108
442
  msgid "Max. TTL:"
443
  msgstr ""
444
 
445
+ #: includes/ui/tabs/overview.php:114
446
  msgid "This doesn’t appear to be a valid number."
447
  msgstr ""
448
 
449
+ #: includes/ui/tabs/overview.php:126
450
  msgid "Connection"
451
  msgstr ""
452
 
453
+ #: includes/ui/tabs/overview.php:133
454
  msgid "Client:"
455
  msgstr ""
456
 
457
+ #: includes/ui/tabs/overview.php:142
458
  msgid "Host:"
459
  msgstr ""
460
 
461
+ #: includes/ui/tabs/overview.php:149
462
  msgid "Cluster:"
463
  msgstr ""
464
 
465
+ #: includes/ui/tabs/overview.php:162
466
  msgid "Shards:"
467
  msgstr ""
468
 
469
+ #: includes/ui/tabs/overview.php:175
470
  msgid "Servers:"
471
  msgstr ""
472
 
473
+ #: includes/ui/tabs/overview.php:188
474
  msgid "Port:"
475
  msgstr ""
476
 
477
+ #: includes/ui/tabs/overview.php:195
478
  msgid "Username:"
479
  msgstr ""
480
 
481
+ #: includes/ui/tabs/overview.php:202
482
  msgid "Password:"
483
  msgstr ""
484
 
485
+ #: includes/ui/tabs/overview.php:211
486
  msgid "Database:"
487
  msgstr ""
488
 
489
+ #: includes/ui/tabs/overview.php:218
490
  msgid "Connection Timeout:"
491
  msgstr ""
492
 
493
  #. translators: %s = Redis connection/read timeout in seconds.
494
+ #: includes/ui/tabs/overview.php:224
495
+ #: includes/ui/tabs/overview.php:241
496
  msgid "%ss"
497
  msgstr ""
498
 
499
+ #: includes/ui/tabs/overview.php:235
500
  msgid "Read Timeout:"
501
  msgstr ""
502
 
503
+ #: includes/ui/tabs/overview.php:252
504
  msgid "Retry Interval:"
505
  msgstr ""
506
 
507
  #. translators: %s = Redis retry interval in milliseconds.
508
+ #: includes/ui/tabs/overview.php:258
509
  msgid "%sms"
510
  msgstr ""
511
 
512
+ #: includes/ui/tabs/overview.php:269
513
  msgid "Redis Version:"
514
  msgstr ""
515
 
516
+ #: includes/ui/tabs/overview.php:282
517
  msgid "Flush Cache"
518
  msgstr ""
519
 
520
+ #: includes/ui/tabs/overview.php:288
521
  msgid "Disable Object Cache"
522
  msgstr ""
523
 
524
+ #: includes/ui/tabs/overview.php:292
525
  msgid "Enable Object Cache"
526
  msgstr ""
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: redis, object cache, cache, object caching, caching performance, relay, pr
5
  Requires at least: 3.3
6
  Tested up to: 6.0
7
  Requires PHP: 7.2
8
- Stable tag: 2.2.1
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.2.1 =
87
 
88
  - Added WordPress 6.1 `wp_cache_supports()` function
@@ -613,6 +618,6 @@ Since Predis isn't maintained any longer, it's highly recommended to switch over
613
 
614
  == Upgrade Notice ==
615
 
616
- = 2.2.1 =
617
 
618
  New WordPress 6.1 functions, updated Predis to v2.0.3 and various improvements.
5
  Requires at least: 3.3
6
  Tested up to: 6.0
7
  Requires PHP: 7.2
8
+ Stable tag: 2.2.2
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
83
 
84
  == Changelog ==
85
 
86
+ = 2.2.2 =
87
+
88
+ - Use `QM_Data_Cache` instead of `QM_Data`
89
+ - Fixed `WP_Error` use statement non-compound name warning
90
+
91
  = 2.2.1 =
92
 
93
  - Added WordPress 6.1 `wp_cache_supports()` function
618
 
619
  == Upgrade Notice ==
620
 
621
+ = 2.2.2 =
622
 
623
  New WordPress 6.1 functions, updated Predis to v2.0.3 and various improvements.
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, Relay, replication, sentinels, clustering and WP-CLI.
6
- * Version: 2.2.1
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, Relay, replication, sentinels, clustering and WP-CLI.
6
+ * Version: 2.2.2
7
  * Text Domain: redis-cache
8
  * Domain Path: /languages
9
  * Network: true