ソースを参照

两个构造方法添加 boolean cache 参数

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

+ 4 - 4
src/main/java/com/jfinal/template/MemoryStringSource.java

@@ -27,20 +27,20 @@ public class MemoryStringSource implements IStringSource {
 	private String key;
 	private StringBuilder content;
 	
-	public MemoryStringSource(String content) {
+	public MemoryStringSource(String content, boolean cache) {
 		if (StrKit.isBlank(content)) {
 			throw new IllegalArgumentException("content can not be blank");
 		}
 		this.content = new StringBuilder(content);
-		this.key = HashKit.md5(content);
+		this.key = cache ? HashKit.md5(content) : null;	// 
 	}
 	
-	public MemoryStringSource(StringBuilder content) {
+	public MemoryStringSource(StringBuilder content, boolean cache) {
 		if (content == null || content.length() == 0) {
 			throw new IllegalArgumentException("content can not be blank");
 		}
 		this.content = content;
-		this.key = HashKit.md5(content.toString());
+		this.key = cache ? HashKit.md5(content.toString()) : null;
 	}
 	
 	public boolean isModified() {