| 程序包 | 说明 |
|---|---|
| com.jfinal.template |
| 限定符和类型 | 方法和说明 |
|---|---|
Template |
Engine.getTemplate(ISource source)
Get template by implementation of ISource
|
Template |
Engine.getTemplate(String fileName)
Get template by file name
|
Template |
Engine.getTemplateByString(String content)
Get template by string content and do not cache the template
|
Template |
Engine.getTemplateByString(String content,
boolean cache)
Get template by string content
重要:StringSource 中的 cacheKey = HashKit.md5(content),也即 cacheKey
与 content 有紧密的对应关系,当 content 发生变化时 cacheKey 值也相应变化
因此,原先 cacheKey 所对应的 Template 缓存对象已无法被获取,当 getTemplateByString(String)
的 String 参数的数量不确定时会引发内存泄漏
当 getTemplateByString(String, boolean) 中的 String 参数的
数量可控并且确定时,才可对其使用缓存
|
Template |
Engine.getTemplateByString(String content,
String cacheKey) |
Copyright © 2024. All rights reserved.