1717use Memcache as MemcacheSoftware ;
1818use phpFastCache \Core \DriverAbstract ;
1919use phpFastCache \Core \MemcacheDriverCollisionDetectorTrait ;
20- use phpFastCache \Core \StandardPsr6StructureTrait ;
2120use phpFastCache \Entities \driverStatistic ;
2221use phpFastCache \Exceptions \phpFastCacheDriverCheckException ;
2322use phpFastCache \Exceptions \phpFastCacheDriverException ;
2625/**
2726 * Class Driver
2827 * @package phpFastCache\Drivers
28+ * @property MemcacheSoftware $instance
2929 */
3030class Driver extends DriverAbstract
3131{
@@ -49,7 +49,6 @@ public function __construct(array $config = [])
4949 if (!$ this ->driverCheck ()) {
5050 throw new phpFastCacheDriverCheckException (sprintf (self ::DRIVER_CHECK_FAILURE , $ this ->getDriverName ()));
5151 } else {
52- $ this ->instance = new MemcacheSoftware ();
5352 $ this ->driverConnect ();
5453
5554 if (array_key_exists ('compress_data ' , $ config ) && $ config [ 'compress_data ' ] === true ) {
@@ -128,16 +127,23 @@ protected function driverClear()
128127 */
129128 protected function driverConnect ()
130129 {
131- $ servers = (!empty ($ this ->config [ 'memcache ' ]) && is_array ($ this ->config [ 'memcache ' ]) ? $ this ->config [ 'memcache ' ] : []);
130+ $ this ->instance = new MemcacheSoftware ();
131+
132+ $ servers = (!empty ($ this ->config [ 'servers ' ]) && is_array ($ this ->config [ 'servers ' ]) ? $ this ->config [ 'servers ' ] : []);
132133 if (count ($ servers ) < 1 ) {
133134 $ servers = [
134- ['127.0.0.1 ' , 11211 ],
135+ [
136+ 'host ' =>'127.0.0.1 ' ,
137+ 'port ' => 11211 ,
138+ 'sasl_user ' => false ,
139+ 'sasl_password ' => false
140+ ],
135141 ];
136142 }
137143
138144 foreach ($ servers as $ server ) {
139145 try {
140- if (!$ this ->instance ->addserver ($ server [ 0 ], $ server [ 1 ])) {
146+ if (!$ this ->instance ->addServer ($ server [' host ' ], $ server [' port ' ])) {
141147 $ this ->fallback = true ;
142148 }
143149 if (!empty ($ server [ 'sasl_user ' ]) && !empty ($ server [ 'sasl_password ' ])){
0 commit comments