| @@ 129-147 (lines=19) @@ | ||
| 126 | /** |
|
| 127 | * @return bool |
|
| 128 | */ |
|
| 129 | public function driverConnect() |
|
| 130 | { |
|
| 131 | $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
|
| 132 | if (count($servers) < 1) { |
|
| 133 | $servers = [ |
|
| 134 | ['127.0.0.1', 11211], |
|
| 135 | ]; |
|
| 136 | } |
|
| 137 | ||
| 138 | foreach ($servers as $server) { |
|
| 139 | try { |
|
| 140 | if (!$this->instance->addserver($server[ 0 ], $server[ 1 ])) { |
|
| 141 | $this->fallback = true; |
|
| 142 | } |
|
| 143 | } catch (\Exception $e) { |
|
| 144 | $this->fallback = true; |
|
| 145 | } |
|
| 146 | } |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * @param \Psr\Cache\CacheItemInterface $item |
|
| @@ 128-146 (lines=19) @@ | ||
| 125 | /** |
|
| 126 | * @return bool |
|
| 127 | */ |
|
| 128 | public function driverConnect() |
|
| 129 | { |
|
| 130 | $servers = (!empty($this->config[ 'memcache' ]) && is_array($this->config[ 'memcache' ]) ? $this->config[ 'memcache' ] : []); |
|
| 131 | if (count($servers) < 1) { |
|
| 132 | $servers = [ |
|
| 133 | ['127.0.0.1', 11211], |
|
| 134 | ]; |
|
| 135 | } |
|
| 136 | ||
| 137 | foreach ($servers as $server) { |
|
| 138 | try { |
|
| 139 | if (!$this->instance->addServer($server[ 0 ], $server[ 1 ])) { |
|
| 140 | $this->fallback = true; |
|
| 141 | } |
|
| 142 | } catch (\Exception $e) { |
|
| 143 | $this->fallback = true; |
|
| 144 | } |
|
| 145 | } |
|
| 146 | } |
|
| 147 | ||
| 148 | /** |
|
| 149 | * @param \Psr\Cache\CacheItemInterface $item |
|