redis = new \Redis(); if ( !$this -> redis -> connect( $config['redis']['host'], $config['redis']['port'] ) ) { throw new Exception("Nie udało się połączyć z serwerem Redis."); } // Autentykacja za pomocą hasła if ( !$this -> redis -> auth( $config['redis']['password'] ) ) { } } public static function getInstance() { if ( self::$instance === null ) { self::$instance = new self(); } return self::$instance; } public function getConnection() { return $this->redis; } }