const handlebars = require('handlebars');
const Cache = require('nice-cache');
const utils = require('./utils');

const cache = new Cache();
const cacheType = 'handlebars-precompiled-template';

module.exports = (options, callback) => {
  let linked;
  const cached = options.key && cache.get(cacheType, options.key);

  if (!cached) {
    const validationResult = utils.validator(options.template);
    if (!validationResult.isValid) {
      return callback(validationResult.error);
    }

    try {
      linked = handlebars.template(options.template);
      cache.set(cacheType, options.key);
    } catch (e) {
      return callback(e);
    }
  }

  try {
    const html = linked(options.model);
    return callback(null, html);
  } catch (e) {
    return callback(e);
  }
};

@@ -71,16 +71,66 @@
 cache');
+%0A%0Aconst %7B name, version %7D = require('../package');
 %0Aconst u
@@ -202,27 +202,35 @@
 eType = 
-'handlebars
+%60$%7Bname%7D-$%7Bversion%7D
 -precomp
@@ -237,18 +237,9 @@
 iled
--template'
+%60
 ;%0A%0Am

Rename the cache name