1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-02 12:57:35 +01:00

RedisCacheDriver.php: fixup

This commit is contained in:
Zankaria 2024-12-01 17:33:17 +01:00
parent 5a3fead579
commit b7a9f47a1b

View File

@ -8,7 +8,7 @@ class RedisCacheDriver implements CacheDriver {
private string $prefix; private string $prefix;
private \Redis $inner; private \Redis $inner;
public function __construct(string $prefix, string $host, ?int $port, ?string $password, string $database) { public function __construct(string $prefix, string $host, ?int $port, ?string $password, int $database) {
$this->inner = new \Redis(); $this->inner = new \Redis();
if (str_starts_with($host, 'unix:') || str_starts_with($host, ':')) { if (str_starts_with($host, 'unix:') || str_starts_with($host, ':')) {
$ret = \explode(':', $host); $ret = \explode(':', $host);
@ -30,10 +30,10 @@ class RedisCacheDriver implements CacheDriver {
throw new \RuntimeException('Unable to configure Redis serializer'); throw new \RuntimeException('Unable to configure Redis serializer');
} }
if (!$this->inner->select($database)) { if (!$this->inner->select($database)) {
throw new \RuntimeException('Unable to connect to Redis!'); throw new \RuntimeException('Unable to connect to Redis database!');
} }
$$this->prefix = $prefix; $this->prefix = $prefix;
} }
public function get(string $key): mixed { public function get(string $key): mixed {