String file = extractMacroParameter(parameters, FILE_PARAM_KEY);
StringBuilder gistUrl = createGistUrl(id, file);
if(parameters.containsKey(PREFETCH_PARAM_KEY) && TRUE.equals(parameters.get(PREFETCH_PARAM_KEY))){
Cache cache = cacheManager.getCache(CACHE_KEY);
String key = getCacheKey(id, file);
String contents = (String) cache.get(key);
if(contents == null) {
String proxyHost = extractMacroParameter(parameters, PROXY_HOST_PARAM_KEY);
String proxyPort = extractMacroParameter(parameters, PROXY_PORT_PARAM_KEY);
contents = fetchGistUrl(gistUrl.toString(), proxyHost, proxyPort);
cache.put(key, contents);
}
return contents;
} else {
StringBuilder sb = new StringBuilder();
sb.append(SCRIPT_START);