Version Description
- Added
is_predis()
helper
Download this release
Release Info
Developer | tillkruess |
Plugin | Redis Object Cache |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- includes/object-cache.php +17 -10
- languages/redis-cache.pot +3 -3
- readme.txt +6 -2
- redis-cache.php +1 -1
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.1.
|
7 |
* Author: Till Krüss
|
8 |
* Author URI: https://objectcache.pro
|
9 |
* License: GPLv3
|
@@ -1184,7 +1184,7 @@ class WP_Object_Cache {
|
|
1184 |
|
1185 |
$args = [ $derived_key, $this->maybe_serialize( $value ) ];
|
1186 |
|
1187 |
-
if ( $this->
|
1188 |
$args[] = 'nx';
|
1189 |
|
1190 |
if ( $expire ) {
|
@@ -1205,7 +1205,7 @@ class WP_Object_Cache {
|
|
1205 |
try {
|
1206 |
$start_time = microtime( true );
|
1207 |
|
1208 |
-
$method =
|
1209 |
|
1210 |
$results = array_map( function ( $response ) {
|
1211 |
return (bool) $this->parse_redis_response( $response );
|
@@ -1295,7 +1295,7 @@ class WP_Object_Cache {
|
|
1295 |
if ( $add ) {
|
1296 |
$args = [ $derived_key, $this->maybe_serialize( $value ) ];
|
1297 |
|
1298 |
-
if ( $this->
|
1299 |
$args[] = 'nx';
|
1300 |
|
1301 |
if ( $expiration ) {
|
@@ -1450,7 +1450,7 @@ class WP_Object_Cache {
|
|
1450 |
unset( $this->cache[ $derived_key ] );
|
1451 |
}
|
1452 |
|
1453 |
-
$method =
|
1454 |
|
1455 |
$results = array_map( function ( $response ) {
|
1456 |
return (bool) $this->parse_redis_response( $response );
|
@@ -1657,9 +1657,7 @@ LUA;
|
|
1657 |
$script = 'redis.replicate_commands()' . "\n" . $script;
|
1658 |
}
|
1659 |
|
1660 |
-
$args = ( $
|
1661 |
-
? [ $script, 0 ]
|
1662 |
-
: [ $script ];
|
1663 |
|
1664 |
return call_user_func_array( [ $this->redis, 'eval' ], $args );
|
1665 |
};
|
@@ -1711,7 +1709,7 @@ LUA;
|
|
1711 |
$script = 'redis.replicate_commands()' . "\n" . $script;
|
1712 |
}
|
1713 |
|
1714 |
-
$args =
|
1715 |
? array_merge( [ $script, count( $unflushable ) ], $unflushable )
|
1716 |
: [ $script, $unflushable, count( $unflushable ) ];
|
1717 |
|
@@ -2097,7 +2095,7 @@ LUA;
|
|
2097 |
}
|
2098 |
|
2099 |
try {
|
2100 |
-
$method =
|
2101 |
|
2102 |
$results = array_map( function ( $response ) {
|
2103 |
return (bool) $this->parse_redis_response( $response );
|
@@ -2731,6 +2729,15 @@ LUA;
|
|
2731 |
return $cluster;
|
2732 |
}
|
2733 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2734 |
/**
|
2735 |
* Allows access to private properties for backwards compatibility.
|
2736 |
*
|
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.1.4
|
7 |
* Author: Till Krüss
|
8 |
* Author URI: https://objectcache.pro
|
9 |
* License: GPLv3
|
1184 |
|
1185 |
$args = [ $derived_key, $this->maybe_serialize( $value ) ];
|
1186 |
|
1187 |
+
if ( $this->is_predis() ) {
|
1188 |
$args[] = 'nx';
|
1189 |
|
1190 |
if ( $expire ) {
|
1205 |
try {
|
1206 |
$start_time = microtime( true );
|
1207 |
|
1208 |
+
$method = $this->is_predis() ? 'execute' : 'exec';
|
1209 |
|
1210 |
$results = array_map( function ( $response ) {
|
1211 |
return (bool) $this->parse_redis_response( $response );
|
1295 |
if ( $add ) {
|
1296 |
$args = [ $derived_key, $this->maybe_serialize( $value ) ];
|
1297 |
|
1298 |
+
if ( $this->is_predis() ) {
|
1299 |
$args[] = 'nx';
|
1300 |
|
1301 |
if ( $expiration ) {
|
1450 |
unset( $this->cache[ $derived_key ] );
|
1451 |
}
|
1452 |
|
1453 |
+
$method = $this->is_predis() ? 'execute' : 'exec';
|
1454 |
|
1455 |
$results = array_map( function ( $response ) {
|
1456 |
return (bool) $this->parse_redis_response( $response );
|
1657 |
$script = 'redis.replicate_commands()' . "\n" . $script;
|
1658 |
}
|
1659 |
|
1660 |
+
$args = is_predis() ? [ $script, 0 ] : [ $script ];
|
|
|
|
|
1661 |
|
1662 |
return call_user_func_array( [ $this->redis, 'eval' ], $args );
|
1663 |
};
|
1709 |
$script = 'redis.replicate_commands()' . "\n" . $script;
|
1710 |
}
|
1711 |
|
1712 |
+
$args = $this->is_predis()
|
1713 |
? array_merge( [ $script, count( $unflushable ) ], $unflushable )
|
1714 |
: [ $script, $unflushable, count( $unflushable ) ];
|
1715 |
|
2095 |
}
|
2096 |
|
2097 |
try {
|
2098 |
+
$method = $this->is_predis() ? 'execute' : 'exec';
|
2099 |
|
2100 |
$results = array_map( function ( $response ) {
|
2101 |
return (bool) $this->parse_redis_response( $response );
|
2729 |
return $cluster;
|
2730 |
}
|
2731 |
|
2732 |
+
/**
|
2733 |
+
* Check whether Predis client is in use.
|
2734 |
+
*
|
2735 |
+
* @return bool
|
2736 |
+
*/
|
2737 |
+
protected function is_predis() {
|
2738 |
+
return $this->redis instanceof Predis\Client;
|
2739 |
+
}
|
2740 |
+
|
2741 |
/**
|
2742 |
* Allows access to private properties for backwards compatibility.
|
2743 |
*
|
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.1.
|
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-07-
|
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"
|
@@ -358,7 +358,7 @@ msgstr ""
|
|
358 |
|
359 |
#. translators: %s = PHP Version.
|
360 |
#: includes/ui/settings.php:125
|
361 |
-
msgid "The current version of PHP (%s) is too old. PHP 7.
|
362 |
msgstr ""
|
363 |
|
364 |
#: includes/ui/settings.php:134
|
2 |
# This file is distributed under the GPLv3.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Redis Object Cache 2.1.3\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-07-20T18:43:43+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"
|
358 |
|
359 |
#. translators: %s = PHP Version.
|
360 |
#: includes/ui/settings.php:125
|
361 |
+
msgid "The current version of PHP (%s) is too old. PHP 7.2 or newer is required."
|
362 |
msgstr ""
|
363 |
|
364 |
#: includes/ui/settings.php:134
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: redis, predis, phpredis, credis, relay, caching, cache, object cache, perf
|
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 7.2
|
8 |
-
Stable tag: 2.1.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -83,6 +83,10 @@ To see a list of all available WP-CLI commands, please see the [WP CLI commands
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
86 |
= 2.1.3 =
|
87 |
|
88 |
- Fixed bug in `wp_cache_add_multiple()` and `wp_cache_set_multiple()`
|
@@ -584,6 +588,6 @@ Since Predis isn't maintained any longer, it's highly recommended to switch over
|
|
584 |
|
585 |
== Upgrade Notice ==
|
586 |
|
587 |
-
= 2.1.
|
588 |
|
589 |
Bumped PHP requirement to 7.2, updated Predis to v2.0 and deprecated Credis and HHVM clients.
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 6.0
|
7 |
Requires PHP: 7.2
|
8 |
+
Stable tag: 2.1.4
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 2.1.4 =
|
87 |
+
|
88 |
+
- Added `is_predis()` helper
|
89 |
+
|
90 |
= 2.1.3 =
|
91 |
|
92 |
- Fixed bug in `wp_cache_add_multiple()` and `wp_cache_set_multiple()`
|
588 |
|
589 |
== Upgrade Notice ==
|
590 |
|
591 |
+
= 2.1.4 =
|
592 |
|
593 |
Bumped PHP requirement to 7.2, updated Predis to v2.0 and deprecated Credis and HHVM clients.
|
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.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.1.4
|
7 |
* Text Domain: redis-cache
|
8 |
* Domain Path: /languages
|
9 |
* Network: true
|