We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fc0a175 commit 6a0fe72Copy full SHA for 6a0fe72
src/drop-in/object-cache.php
@@ -65,9 +65,13 @@ public function __construct(
65
// https://www.php.net/manual/en/memcached.construct.php
66
$mc = new Memcached( $persistent_id );
67
68
- if ( SNAPCACHE_MEMCACHED_USE_BINARY === true
69
- && $mc->getOption( Memcached::OPT_BINARY_PROTOCOL ) === false ) {
70
- $result = $mc->setOption( Memcached::OPT_BINARY_PROTOCOL, true );
+ // We can only enable binary protocol for new connections
+ if ( $mc->isPristine() ) {
+ $result = $mc->setOptions(
71
+ [
72
+ Memcached::OPT_BINARY_PROTOCOL => SNAPCACHE_MEMCACHED_USE_BINARY === true,
73
+ ]
74
+ );
75
76
if ( $result === false ) {
77
error_log( 'Failed to enable binary protocol for Memcached' );
0 commit comments