original_string: public function cache(callable $block, array $options = [])
      {
          $options += ['key' => '', 'config' => $this->elementCache];
          if (empty($options['key'])) {
              throw new RuntimeException('Cannot cache content with an empty key');
          }
          $result = Cache::read($options['key'], $options['config']);
          if ($result) {
              return $result;
          }
          ob_start();
          $block();
          $result = ob_get_clean();
  
          Cache::write($options['key'], $result, $options['config']);
  
          return $result;
      }
code: public function cache(callable $block, array $options = [])
      {
          $options += ['key' => '', 'config' => $this->elementCache];
          if (empty($options['key'])) {
              throw new RuntimeException('Cannot cache content with an empty key');
          }
          $result = Cache::read($options['key'], $options['config']);
          if ($result) {
              return $result;
          }
          ob_start();
          $block();
          $result = ob_get_clean();
  
          Cache::write($options['key'], $result, $options['config']);
  
          return $result;
      }
code_tokens: public function cache ( callable $ block , array $ options = [ ] ) { $ options += [ 'key' => '' , 'config' => $ this -> elementCache ] ; if ( empty ( $ options [ 'key' ] ) ) { throw new RuntimeException ( 'Cannot cache content with an empty key' ) ; } $ result = Cache :: read ( $ options [ 'key' ] , $ options [ 'config' ] ) ; if ( $ result ) { return $ result ; } ob_start ( ) ; $ block ( ) ; $ result = ob_get_clean ( ) ; Cache :: write ( $ options [ 'key' ] , $ result , $ options [ 'config' ] ) ; return $ result ; }
docstring: Create a cached block of view logic.
  
  This allows you to cache a block of view output into the cache
  defined in `elementCache`.
  
  This method will attempt to read the cache first. If the cache
  is empty, the $block will be run and the output stored.
  
  @param callable $block The block of code that you want to cache the output of.
  @param array $options The options defining the cache key etc.
  @return string The rendered content.
  @throws \RuntimeException When $options is lacking a 'key' option.
docstring_tokens: Create a cached block of view logic .