code: function handleCache(options, template) {
    var fn
      , path = options.filename
      , hasTemplate = arguments.length > 1;
  
    if (options.cache) {
      if (!path) {
        throw new Error('cache option requires a filename');
      }
      fn = exports.cache.get(path);
      if (fn) {
        return fn;
      }
      if (!hasTemplate) {
        template = fs.readFileSync(path).toString().replace(_BOM, '');
      }
    }
    else if (!hasTemplate) {
      // istanbul ignore if: should not happen at all
      if (!path) {
        throw new Error('Internal EJS error: no file name or template '
                      + 'provided');
      }
      template = fs.readFileSync(path).toString().replace(_BOM, '');
    }
    fn = exports.compile(template, options);
    if (options.cache) {
      exports.cache.set(path, fn);
    }
    return fn;
  }
docs: Get the template from a string or a file, either compiled on-the-fly or
  read from cache (if enabled), and cache the template if needed.
  
  If `template` is not set, the file specified in `options.filename` will be
  read.
  
  If `options.cache` is true, this function reads the file from
  `options.filename` so it must be set prior to calling this function.
  
  @memberof module:ejs-internal
  @param {Options} options   compilation options
  @param {String} [template] template source
  @return {(TemplateFunction|ClientFunction)}
  Depending on the value of `options.client`, either type might be returned.
  @static