Browse Source

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

JFinal 4 years ago
parent
commit
ab74276fb0
1 changed files with 4 additions and 3 deletions
  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));
 		}
 		
-		String cacheKey = HashKit.md5(content);
+		StringSource source = new StringSource(content, cache);
+		String cacheKey = source.getCacheKey();
 		Template template = templateCache.get(cacheKey);
 		if (template == null) {
-			template = buildTemplateBySource(new StringSource(content, cache));
+			template = buildTemplateBySource(source);
 			templateCache.put(cacheKey, template);
 		} else if (devMode) {
 			if (template.isModified()) {
-				template = buildTemplateBySource(new StringSource(content, cache));
+				template = buildTemplateBySource(source);
 				templateCache.put(cacheKey, template);
 			}
 		}