original_string: public function check_redis()
      {
  
          $this->line(' * Checking Redis');
          $this->table(['Setting', 'Value'], [
              ['Host', config('database.redis.default.host')],
              ['Port', config('database.redis.default.port')],
              ['Database', config('database.redis.default.database')],
          ]);
  
          $test_key = str_random(64);
  
          try {
  
              if (config('database.redis.default.path') && config('database.redis.default.scheme')) {
                  $redis = new Client([
                      'scheme' => config('database.redis.default.scheme'),
                      'path'   => config('database.redis.default.path'),
                  ]);
              } else {
                  $redis = new Client([
                      'host' => config('database.redis.default.host'),
                      'port' => config('database.redis.default.port'),
                  ]);
              }
  
              $this->info('Connected to Redis');
  
              $redis->set($test_key, Carbon::now());
              $this->info('Set random key of: ' . $test_key);
  
              $redis->expire($test_key, 10);
              $this->info('Set key to expire in 10 sec');
  
              $redis->get($test_key);
              $this->info('Read key OK');
  
          } catch (Exception $e) {
  
              $this->error('Redis test failed. ' . $e->getMessage());
  
          }
      }
code: public function check_redis()
      {
  
          $this->line(' * Checking Redis');
          $this->table(['Setting', 'Value'], [
              ['Host', config('database.redis.default.host')],
              ['Port', config('database.redis.default.port')],
              ['Database', config('database.redis.default.database')],
          ]);
  
          $test_key = str_random(64);
  
          try {
  
              if (config('database.redis.default.path') && config('database.redis.default.scheme')) {
                  $redis = new Client([
                      'scheme' => config('database.redis.default.scheme'),
                      'path'   => config('database.redis.default.path'),
                  ]);
              } else {
                  $redis = new Client([
                      'host' => config('database.redis.default.host'),
                      'port' => config('database.redis.default.port'),
                  ]);
              }
  
              $this->info('Connected to Redis');
  
              $redis->set($test_key, Carbon::now());
              $this->info('Set random key of: ' . $test_key);
  
              $redis->expire($test_key, 10);
              $this->info('Set key to expire in 10 sec');
  
              $redis->get($test_key);
              $this->info('Read key OK');
  
          } catch (Exception $e) {
  
              $this->error('Redis test failed. ' . $e->getMessage());
  
          }
      }
code_tokens: public function check_redis ( ) { $ this -> line ( ' * Checking Redis' ) ; $ this -> table ( [ 'Setting' , 'Value' ] , [ [ 'Host' , config ( 'database.redis.default.host' ) ] , [ 'Port' , config ( 'database.redis.default.port' ) ] , [ 'Database' , config ( 'database.redis.default.database' ) ] , ] ) ; $ test_key = str_random ( 64 ) ; try { if ( config ( 'database.redis.default.path' ) && config ( 'database.redis.default.scheme' ) ) { $ redis = new Client ( [ 'scheme' => config ( 'database.redis.default.scheme' ) , 'path' => config ( 'database.redis.default.path' ) , ] ) ; } else { $ redis = new Client ( [ 'host' => config ( 'database.redis.default.host' ) , 'port' => config ( 'database.redis.default.port' ) , ] ) ; } $ this -> info ( 'Connected to Redis' ) ; $ redis -> set ( $ test_key , Carbon :: now ( ) ) ; $ this -> info ( 'Set random key of: ' . $ test_key ) ; $ redis -> expire ( $ test_key , 10 ) ; $ this -> info ( 'Set key to expire in 10 sec' ) ; $ redis -> get ( $ test_key ) ; $ this -> info ( 'Read key OK' ) ; } catch ( Exception $ e ) { $ this -> error ( 'Redis test failed. ' . $ e -> getMessage ( ) ) ; } }
docstring: Check of redis access is OK.
docstring_tokens: Check of redis access is OK .