James 8 年 前
コミット
60a6947615
1 ファイル変更7 行追加2 行削除
  1. 7 2
      src/main/java/com/jfinal/template/MemoryStringSource.java

+ 7 - 2
src/main/java/com/jfinal/template/MemoryStringSource.java

@@ -27,12 +27,17 @@ public class MemoryStringSource implements IStringSource {
 	private String key;
 	private String key;
 	private StringBuilder content;
 	private StringBuilder content;
 	
 	
+	/**
+	 * 构造 MemoryStringSource
+	 * @param content 模板内容
+	 * @param cache true 则缓存 Template,否则不缓存
+	 */
 	public MemoryStringSource(String content, boolean cache) {
 	public MemoryStringSource(String content, boolean cache) {
 		if (StrKit.isBlank(content)) {
 		if (StrKit.isBlank(content)) {
 			throw new IllegalArgumentException("content can not be blank");
 			throw new IllegalArgumentException("content can not be blank");
 		}
 		}
 		this.content = new StringBuilder(content);
 		this.content = new StringBuilder(content);
-		this.key = cache ? HashKit.md5(content) : null;	// 
+		this.key = cache ? HashKit.md5(content) : null;	// 不缓存只要将 key 值赋为 null 即可
 	}
 	}
 	
 	
 	public MemoryStringSource(StringBuilder content, boolean cache) {
 	public MemoryStringSource(StringBuilder content, boolean cache) {
@@ -40,7 +45,7 @@ public class MemoryStringSource implements IStringSource {
 			throw new IllegalArgumentException("content can not be blank");
 			throw new IllegalArgumentException("content can not be blank");
 		}
 		}
 		this.content = content;
 		this.content = content;
-		this.key = cache ? HashKit.md5(content.toString()) : null;
+		this.key = cache ? HashKit.md5(content.toString()) : null;	// 不缓存只要将 key 值赋为 null 即可
 	}
 	}
 	
 	
 	public boolean isModified() {
 	public boolean isModified() {