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