freemarker.template.Configuration.getCacheStorage()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中freemarker.template.Configuration.getCacheStorage()方法的一些代码示例,展示了Configuration.getCacheStorage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getCacheStorage()方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:getCacheStorage

Configuration.getCacheStorage介绍

[英]The getter pair of #setCacheStorage(CacheStorage).
[中]#setCacheStorage(CacheStorage)的getter对。

代码示例

代码示例来源:origin: org.freemarker/freemarker

private CacheStorage getDefaultCacheStorage() {
  return createDefaultCacheStorage(getIncompatibleImprovements(), getCacheStorage()); 
}

代码示例来源:origin: org.freemarker/freemarker

/**
 * Sets the {@link CacheStorage} used for caching {@link Template}-s;
 * the earlier content of the template cache will be dropt.
 * 
 * The default is a {@link SoftCacheStorage}. If the total size of the {@link Template}
 * objects is significant but most templates are used rarely, using a
 * {@link MruCacheStorage} instead might be advisable. If you don't want caching at
 * all, use {@link freemarker.cache.NullCacheStorage} (you can't use {@code null}).
 * 
 * <p>Note that setting the cache storage will re-create the template cache, so
 * all its content will be lost.
 */
public void setCacheStorage(CacheStorage cacheStorage) {
  // "synchronized" is removed from the API as it's not safe to set anything after publishing the Configuration
  synchronized (this) {
    if (getCacheStorage() != cacheStorage) {
      recreateTemplateCacheWith(cache.getTemplateLoader(), cacheStorage,
          cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
          cache.getTemplateConfigurations());
    }
    cacheStorageExplicitlySet = true;
  }
}

代码示例来源:origin: org.freemarker/freemarker-gae

private CacheStorage getDefaultCacheStorage() {
  return createDefaultCacheStorage(getIncompatibleImprovements(), getCacheStorage()); 
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

private CacheStorage getDefaultCacheStorage() {
  return createDefaultCacheStorage(getIncompatibleImprovements(), getCacheStorage()); 
}

代码示例来源:origin: org.freemarker/freemarker-gae

/**
 * Sets the {@link CacheStorage} used for caching {@link Template}-s;
 * the earlier content of the template cache will be dropt.
 * 
 * The default is a {@link SoftCacheStorage}. If the total size of the {@link Template}
 * objects is significant but most templates are used rarely, using a
 * {@link MruCacheStorage} instead might be advisable. If you don't want caching at
 * all, use {@link freemarker.cache.NullCacheStorage} (you can't use {@code null}).
 * 
 * <p>Note that setting the cache storage will re-create the template cache, so
 * all its content will be lost.
 */
public void setCacheStorage(CacheStorage cacheStorage) {
  // "synchronized" is removed from the API as it's not safe to set anything after publishing the Configuration
  synchronized (this) {
    if (getCacheStorage() != cacheStorage) {
      recreateTemplateCacheWith(cache.getTemplateLoader(), cacheStorage,
          cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
          cache.getTemplateConfigurations());
    }
    cacheStorageExplicitlySet = true;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

/**
 * Sets the {@link CacheStorage} used for caching {@link Template}-s;
 * the earlier content of the template cache will be dropt.
 * 
 * The default is a {@link SoftCacheStorage}. If the total size of the {@link Template}
 * objects is significant but most templates are used rarely, using a
 * {@link MruCacheStorage} instead might be advisable. If you don't want caching at
 * all, use {@link freemarker.cache.NullCacheStorage} (you can't use {@code null}).
 * 
 * <p>Note that setting the cache storage will re-create the template cache, so
 * all its content will be lost.
 */
public void setCacheStorage(CacheStorage cacheStorage) {
  // "synchronized" is removed from the API as it's not safe to set anything after publishing the Configuration
  synchronized (this) {
    if (getCacheStorage() != cacheStorage) {
      recreateTemplateCacheWith(cache.getTemplateLoader(), cacheStorage,
          cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
          cache.getTemplateConfigurations());
    }
    cacheStorageExplicitlySet = true;
  }
}

相关文章

Configuration类方法