use of org.apache.velocity.runtime.resource.Resource in project wcomponents by BorderTech.
the class VelocityCacheImpl method getCache.
/**
* @return the cache instance
*/
protected synchronized Cache<Object, Resource> getCache() {
Cache<Object, Resource> cache = Caching.getCache(CACHE_NAME, Object.class, Resource.class);
if (cache == null) {
final CacheManager mgr = Caching.getCachingProvider().getCacheManager();
MutableConfiguration<Object, Resource> config = new MutableConfiguration<>();
config.setTypes(Object.class, Resource.class);
config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new Duration(TimeUnit.HOURS, 12)));
// Velocity template classes are not serializable so use by ref.
config.setStoreByValue(false);
cache = mgr.createCache(CACHE_NAME, config);
}
return cache;
}
Aggregations