Skip to content

Commit 46d78c8

Browse files
committed
Fixing build, thanks to Predis :S
1 parent 6d81fdf commit 46d78c8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/phpFastCache/Drivers/Predis/Config.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,17 @@ public function setDatabase(int $database): self
103103
$this->database = $database;
104104
return $this;
105105
}
106+
107+
/**
108+
* @return array
109+
*/
110+
public function getPredisConfigArray(): array
111+
{
112+
return [
113+
'host' => $this->getHost(),
114+
'port' => $this->getPort(),
115+
'password' => $this->getPassword() ?: null,
116+
'database' => $this->getDatabase(),
117+
];
118+
}
106119
}

src/phpFastCache/Drivers/Predis/Driver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ protected function driverConnect(): bool
6161
'path' => $this->config->getOption('path')
6262
]);
6363
}else{
64-
$this->instance = new PredisClient($this->getConfig()->toArray());
64+
var_dump($this->getConfig()->getPredisConfigArray());
65+
$this->instance = new PredisClient($this->getConfig()->getPredisConfigArray());
6566
}
6667

6768
try {
6869
$this->instance->connect();
6970
} catch (PredisConnectionException $e) {
71+
echo $e->getMessage();
7072
throw new phpFastCacheDriverException('Failed to connect to predis server. Check the Predis documentation: https://github.com/nrk/predis/tree/v1.1#how-to-install-and-use-predis', 0, $e);
7173
}
7274

0 commit comments

Comments
 (0)