diff --git a/object-cache.php b/object-cache.php index de34043aebe7a49a0149887435e1119b56fc5073..0e192834cf595da723b18cd946893d717289607c 100644 --- a/object-cache.php +++ b/object-cache.php @@ -326,11 +326,17 @@ class WP_Object_Cache { if ( defined( 'WP_REDIS_BACKEND_DB' ) && WP_REDIS_BACKEND_DB ) { $redis['database'] = WP_REDIS_BACKEND_DB; } + if ( ( defined( 'WP_REDIS_SERIALIZER' ) ) ) { + $redis['serializer'] = WP_REDIS_SERIALIZER; + } else { + $redis['serializer'] = Redis::SERIALIZER_PHP; + } // Use Redis PECL library. try { $this->redis = new Redis(); $this->redis->connect( $redis['host'], $redis['port'] ); + $this->redis->setOption( Redis::OPT_SERIALIZER, $redis['serializer'] ); if ( isset( $redis['auth'] ) ) { $this->redis->auth( $redis['auth'] );