Skip to content

Commit f7b554c

Browse files
committed
Added multiple Memcache(d) configuration style support
1 parent 0b0a1ba commit f7b554c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/phpFastCache/Drivers/Memcache/Driver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ protected function driverConnect()
142142
if (count($servers) < 1) {
143143
$servers = [
144144
[
145-
'host' => '127.0.0.1',
146-
'path' => false,
147-
'port' => 11211,
148-
'sasl_user' => false,
149-
'sasl_password' => false,
145+
'host' => !empty($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1',
146+
'path' => !empty($this->config[ 'path' ]) ? $this->config[ 'path' ] : false,
147+
'port' => !empty($this->config[ 'port' ]) ? $this->config[ 'port' ] : 11211,
148+
'sasl_user' => !empty($this->config[ 'sasl_user' ]) ? $this->config[ 'sasl_user' ] : false,
149+
'sasl_password' =>!empty($this->config[ 'sasl_password' ]) ? $this->config[ 'sasl_password' ]: false,
150150
],
151151
];
152152
}

src/phpFastCache/Drivers/Memcached/Driver.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ protected function driverConnect()
136136
if (count($servers) < 1) {
137137
$servers = [
138138
[
139-
'host' => '127.0.0.1',
140-
'path' => false,
141-
'port' => 11211,
142-
'sasl_user' => false,
143-
'sasl_password' => false,
139+
'host' => !empty($this->config[ 'host' ]) ? $this->config[ 'host' ] : '127.0.0.1',
140+
'path' => !empty($this->config[ 'path' ]) ? $this->config[ 'path' ] : false,
141+
'port' => !empty($this->config[ 'port' ]) ? $this->config[ 'port' ] : 11211,
142+
'sasl_user' => !empty($this->config[ 'sasl_user' ]) ? $this->config[ 'sasl_user' ] : false,
143+
'sasl_password' =>!empty($this->config[ 'sasl_password' ]) ? $this->config[ 'sasl_password' ]: false,
144144
],
145145
];
146146
}

0 commit comments

Comments
 (0)