public Template getTemplate ( ISource source ) { String cacheKey = source . getCacheKey ( ) ; if ( cacheKey == null ) { // cacheKey 为 null 则不缓存，详见 ISource.getCacheKey() 注释 return buildTemplateBySource ( source ) ; } Template template = templateCache . get ( cacheKey ) ; if ( template == null ) { template = buildTemplateBySource ( source ) ; templateCache . put ( cacheKey , template ) ; } else if ( devMode ) { if ( template . isModified ( ) ) { template = buildTemplateBySource ( source ) ; templateCache . put ( cacheKey , template ) ; } } return template ; }
Get template by implementation of ISource