33 * Plugin Name: Redis Object Cache Drop-In
44 * Plugin URI: https://wordpress.org/plugins/redis-cache/
55 * Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
6- * Version: 2.6.3
6+ * Version: 2.6.5
77 * Author: Till Krüss
88 * Author URI: https://objectcache.pro
99 * License: GPLv3
@@ -354,6 +354,7 @@ function wp_cache_add_non_persistent_groups( $groups ) {
354354/**
355355 * Object cache class definition
356356 */
357+ #[AllowDynamicProperties]
357358class WP_Object_Cache {
358359 /**
359360 * The Redis client.
@@ -2411,12 +2412,13 @@ public function increment( $key, $offset = 1, $group = 'default' ) {
24112412 }
24122413
24132414 try {
2414- $ value = (int ) $ this ->parse_redis_response ( $ this ->redis ->get ( $ derived_key ) );
2415+ $ value = (int ) $ this ->parse_redis_response ( $ this ->maybe_unserialize ( $ this -> redis ->get ( $ derived_key ) ) );
24152416 $ value += $ offset ;
24162417 $ result = $ this ->parse_redis_response ( $ this ->redis ->set ( $ derived_key , $ this ->maybe_serialize ( $ value ) ) );
24172418
24182419 if ( $ result ) {
24192420 $ this ->add_to_internal_cache ( $ derived_key , $ value );
2421+ $ result = $ value ;
24202422 }
24212423 } catch ( Exception $ exception ) {
24222424 $ this ->handle_exception ( $ exception );
@@ -2472,12 +2474,13 @@ public function decrement( $key, $offset = 1, $group = 'default' ) {
24722474 }
24732475
24742476 try {
2475- $ value = (int ) $ this ->parse_redis_response ( $ this ->redis ->get ( $ derived_key ) );
2477+ $ value = (int ) $ this ->parse_redis_response ( $ this ->maybe_unserialize ( $ this -> redis ->get ( $ derived_key ) ) );
24762478 $ value -= $ offset ;
24772479 $ result = $ this ->parse_redis_response ( $ this ->redis ->set ( $ derived_key , $ this ->maybe_serialize ( $ value ) ) );
24782480
24792481 if ( $ result ) {
24802482 $ this ->add_to_internal_cache ( $ derived_key , $ value );
2483+ $ result = $ value ;
24812484 }
24822485 } catch ( Exception $ exception ) {
24832486 $ this ->handle_exception ( $ exception );
@@ -2576,7 +2579,6 @@ function ( $keys ) {
25762579 *
25772580 * @param string $key The key under which to store the value, pre-sanitized.
25782581 * @param string $group The group value appended to the $key, pre-sanitized.
2579- *
25802582 * @return string
25812583 */
25822584 public function build_key ( $ key , $ group = 'default ' ) {
@@ -2595,7 +2597,6 @@ public function build_key( $key, $group = 'default' ) {
25952597 *
25962598 * @param string $key The key under which to store the value, pre-sanitized.
25972599 * @param string $group The group value appended to the $key, pre-sanitized.
2598- *
25992600 * @return string
26002601 */
26012602 public function fast_build_key ( $ key , $ group = 'default ' ) {
@@ -2606,15 +2607,15 @@ public function fast_build_key( $key, $group = 'default' ) {
26062607 $ salt = defined ( 'WP_REDIS_PREFIX ' ) ? trim ( WP_REDIS_PREFIX ) : '' ;
26072608
26082609 $ prefix = $ this ->is_global_group ( $ group ) ? $ this ->global_prefix : $ this ->blog_prefix ;
2609- $ prefix = trim ( $ prefix , '_-:$ ' );
2610+ $ prefix = trim ( ( string ) $ prefix , '_-:$ ' );
26102611
26112612 return "{$ salt }{$ prefix }: {$ group }: {$ key }" ;
26122613 }
26132614
26142615 /**
26152616 * Replaces the set group separator by another one
26162617 *
2617- * @param string $part The string to sanitize.
2618+ * @param string $part The string to sanitize.
26182619 * @return string Sanitized string.
26192620 */
26202621 protected function sanitize_key_part ( $ part ) {
0 commit comments