浏览代码

!68 update src/main/java/com/jfinal/template/Engine.java.
Merge pull request !68 from hzh740053757/N/A

JFinal 4 年之前
父节点
当前提交
ab74276fb0
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      src/main/java/com/jfinal/template/Engine.java

+ 4 - 3
src/main/java/com/jfinal/template/Engine.java

@@ -197,14 +197,15 @@ public class Engine {
 			return buildTemplateBySource(new StringSource(content, cache));
 			return buildTemplateBySource(new StringSource(content, cache));
 		}
 		}
 		
 		
-		String cacheKey = HashKit.md5(content);
+		StringSource source = new StringSource(content, cache);
+		String cacheKey = source.getCacheKey();
 		Template template = templateCache.get(cacheKey);
 		Template template = templateCache.get(cacheKey);
 		if (template == null) {
 		if (template == null) {
-			template = buildTemplateBySource(new StringSource(content, cache));
+			template = buildTemplateBySource(source);
 			templateCache.put(cacheKey, template);
 			templateCache.put(cacheKey, template);
 		} else if (devMode) {
 		} else if (devMode) {
 			if (template.isModified()) {
 			if (template.isModified()) {
-				template = buildTemplateBySource(new StringSource(content, cache));
+				template = buildTemplateBySource(source);
 				templateCache.put(cacheKey, template);
 				templateCache.put(cacheKey, template);
 			}
 			}
 		}
 		}