Jenner\SimpleFork\Cache\RedisCache::__construct PHP Метод

__construct() публичный Метод

public __construct ( string $host = '127.0.0.1', integer $port = 6379, integer $database, string $prefix = 'simple-fork' )
$host string
$port integer
$database integer
$prefix string
    public function __construct($host = '127.0.0.1', $port = 6379, $database = 0, $prefix = 'simple-fork')
    {
        $this->redis = new \Redis();
        $connection_result = $this->redis->connect($host, $port);
        if (!$connection_result) {
            throw new \RuntimeException('can not connect to the redis server');
        }
        if ($database != 0) {
            $select_result = $this->redis->select($database);
            if (!$select_result) {
                throw new \RuntimeException('can not select the database');
            }
        }
        if (empty($prefix)) {
            throw new \InvalidArgumentException('prefix can not be empty');
        }
        $this->prefix = $prefix;
    }