Predis\Client::disconnect PHP Method

disconnect() public method

Closes the underlying connection and disconnects from the server.
public disconnect ( )
    public function disconnect()
    {
        $this->connection->disconnect();
    }

Usage Example

Example #1
1
 /**
  * Flush all keys in Redis
  */
 public function clear_redis_cache()
 {
     $redis_host = config('database.redis.default.host');
     $redis_port = config('database.redis.default.port');
     $this->info('Clearing the Redis Cache at: ' . $redis_host . ':' . $redis_port);
     try {
         $redis = new Client(['host' => $redis_host, 'port' => $redis_port]);
         $redis->flushall();
         $redis->disconnect();
     } catch (Exception $e) {
         $this->error('Failed to clear the Redis Cache. Error: ' . $e->getMessage());
     }
     return;
 }
All Usage Examples Of Predis\Client::disconnect