@Override public void initialize() throws InitializationException { try { CacheConfiguration configuration = new CacheConfiguration(CACHE_NAME); CacheFactory cacheFactory = cacheManager.getCacheFactory(); this.cache = cacheFactory.newCache(configuration); } catch (ComponentLookupException | CacheException e) { throw new InitializationException( String.format("Failed to initialize the notification filters preferences cache [%s].", CACHE_NAME), e); } }
@Override public void initialize() throws InitializationException { try { CacheConfiguration configuration = new CacheConfiguration(LESS_FILES_CACHE_ID); CacheFactory cacheFactory = cacheManager.getCacheFactory(); this.cache = cacheFactory.newCache(configuration); } catch (ComponentLookupException | CacheException e) { throw new InitializationException( String.format("Failed to initialize LESS skin files cache [%s].", LESS_FILES_CACHE_ID), e); } } }
@Override public void initialize() throws InitializationException { try { CacheConfiguration configuration = new CacheConfiguration(LESS_COLOR_THEMES_CACHE_ID); CacheFactory cacheFactory = cacheManager.getCacheFactory(); this.cache = cacheFactory.newCache(configuration); } catch (ComponentLookupException | CacheException e) { throw new InitializationException( String.format("Failed to initialize LESS color themes cache [%s].", LESS_COLOR_THEMES_CACHE_ID), e); } } }
@Override public void initialize() throws InitializationException { try { CacheConfiguration configuration = new CacheConfiguration(LESS_FILES_CACHE_ID); CacheFactory cacheFactory = cacheManager.getCacheFactory(); this.cache = cacheFactory.newCache(configuration); } catch (ComponentLookupException | CacheException e) { throw new InitializationException( String.format("Failed to initialize LESS skin files cache [%s].", LESS_FILES_CACHE_ID), e); } } }
@Override public void initialize() throws InitializationException { try { CacheConfiguration configuration = new CacheConfiguration(ICON_SET_CACHE_ID); CacheFactory cacheFactory = cacheManager.getCacheFactory(); this.cache = cacheFactory.newCache(configuration); } catch (ComponentLookupException | CacheException e) { throw new InitializationException("Failed to initialize the IconSet Cache.", e); } }
@Override public void initialize() throws InitializationException { try { // Create the cache CacheConfiguration configuration = new CacheConfiguration(LESS_COLOR_THEMES_CACHE_ID); CacheFactory cacheFactory = cacheManager.getCacheFactory(); super.cache = cacheFactory.newCache(configuration); // The Color Theme only depends on colors which do not depend on the XWikiContext. So we don't handle the // XWikiContext in this cache. super.isContextHandled = false; } catch (ComponentLookupException | CacheException e) { throw new InitializationException( String.format("Failed to initialize LESS color themes cache [%s].", LESS_COLOR_THEMES_CACHE_ID), e); } } }
/** * @return the cache factory. * @since 1.5M2. * @deprecated Since 1.7M1, use {@link CacheManager} component instead using {@link Utils#getComponent(Class)} */ @Deprecated public CacheFactory getCacheFactory() { CacheFactory cacheFactory; String cacheHint = Param("xwiki.cache.cachefactory.hint", null); if (StringUtils.isEmpty(cacheHint) || Utils.getComponent(CacheFactory.class, cacheHint) == null) { CacheManager cacheManager = Utils.getComponent(CacheManager.class); try { cacheFactory = cacheManager.getCacheFactory(); } catch (ComponentLookupException e) { throw new RuntimeException("Failed to get cache factory component", e); } } else { cacheFactory = Utils.getComponent(CacheFactory.class, cacheHint); } return cacheFactory; }