use of org.xwiki.cache.CacheException in project xwiki-platform by xwiki.
the class DefaultRenderingCache method initialize.
@Override
public void initialize() throws InitializationException {
if (this.configuration.isEnabled()) {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setConfigurationId(NAME);
LRUEvictionConfiguration lru = new LRUEvictionConfiguration();
lru.setMaxEntries(this.configuration.getSize());
lru.setLifespan(this.configuration.getDuration());
cacheConfiguration.put(LRUEvictionConfiguration.CONFIGURATIONID, lru);
try {
this.cache.create(cacheConfiguration);
} catch (CacheException e) {
throw new InitializationException("Failed to initialize core rendering cache", e);
}
}
}
use of org.xwiki.cache.CacheException in project xwiki-platform by xwiki.
the class XWikiGroupServiceImpl method initCache.
@Override
public synchronized void initCache(int iCapacity, XWikiContext context) throws XWikiException {
try {
CacheConfiguration configuration = new CacheConfiguration();
configuration.setConfigurationId("xwiki.groupservice.usergroups");
LRUEvictionConfiguration lru = new LRUEvictionConfiguration();
lru.setMaxEntries(iCapacity);
configuration.put(EntryEvictionConfiguration.CONFIGURATIONID, lru);
this.memberGroupsCache = Utils.getComponent(CacheManager.class).createNewCache(configuration);
} catch (CacheException e) {
throw new XWikiException(XWikiException.MODULE_XWIKI_CACHE, XWikiException.ERROR_CACHE_INITIALIZING, "Failed to initialize cache", e);
}
}
Aggregations