File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 18
18
require __DIR__ . '/../vendor/autoload.php ' ;
19
19
20
20
$ InstanceCache = CacheManager::getInstance ('memcache ' );
21
- // Or with compress_data option
22
- // $InstanceCache = CacheManager::getInstance('memcache', ['compress_data' => true]);
21
+ /**
22
+ * In case you need to enable compress_data option:
23
+ * $InstanceCache = CacheManager::getInstance('memcache', ['compress_data' => true]);
24
+ *
25
+ * In case you need SASL authentication:
26
+ * $InstanceCache = CacheManager::getInstance('memcache', ['sasl_user' => 'hackerman', 'sasl_password' => '12345']);
27
+ * Warning: Memcache needs to be compiled with a specific option (--enable-memcached-sasl) to use sasl authentication, see:
28
+ * http://php.net/manual/fr/memcached.installation.php
29
+ */
23
30
24
31
/**
25
32
* Try to get $products from Caching First
Original file line number Diff line number Diff line change 18
18
require __DIR__ . '/../vendor/autoload.php ' ;
19
19
20
20
$ InstanceCache = CacheManager::getInstance ('memcached ' );
21
+ /**
22
+ * In case you need SASL authentication:
23
+ * $InstanceCache = CacheManager::getInstance('memcache', ['sasl_user' => 'hackerman', 'sasl_password' => '12345']);
24
+ * Warning: Memcache needs to be compiled with a specific option (--enable-memcached-sasl) to use sasl authentication, see:
25
+ * http://php.net/manual/fr/memcached.installation.php
26
+ */
21
27
22
28
/**
23
29
* Try to get $products from Caching First
Original file line number Diff line number Diff line change @@ -140,6 +140,9 @@ protected function driverConnect()
140
140
if (!$ this ->instance ->addserver ($ server [ 0 ], $ server [ 1 ])) {
141
141
$ this ->fallback = true ;
142
142
}
143
+ if (!empty ($ server [ 'sasl_user ' ]) && !empty ($ server [ 'sasl_password ' ])){
144
+ $ this ->instance ->setSaslAuthData ($ server [ 'sasl_user ' ], $ server [ 'sasl_password ' ]);
145
+ }
143
146
} catch (\Exception $ e ) {
144
147
$ this ->fallback = true ;
145
148
}
Original file line number Diff line number Diff line change @@ -139,6 +139,9 @@ protected function driverConnect()
139
139
if (!$ this ->instance ->addServer ($ server [ 0 ], $ server [ 1 ])) {
140
140
$ this ->fallback = true ;
141
141
}
142
+ if (!empty ($ server [ 'sasl_user ' ]) && !empty ($ server [ 'sasl_password ' ])){
143
+ $ this ->instance ->setSaslAuthData ($ server [ 'sasl_user ' ], $ server [ 'sasl_password ' ]);
144
+ }
142
145
} catch (\Exception $ e ) {
143
146
$ this ->fallback = true ;
144
147
}
You can’t perform that action at this time.
0 commit comments