/** * Lookup the cache component with provided hint and create a new cache. * * @param <T> the class of the data stored in the cache. * @param config the cache configuration. * @param cacheHint the role hint to lookup. * @return a new {@link Cache}. * @throws CacheException error when creating the cache. */ public <T> Cache<T> createNewCache(CacheConfiguration config, String cacheHint) throws CacheException { CacheFactory cacheFactory; try { cacheFactory = this.componentManager.getInstance(CacheFactory.class, cacheHint); } catch (ComponentLookupException e) { throw new CacheException("Failed to get cache factory for role hint [" + cacheHint + "]", e); } return cacheFactory.newCache(config); } }
/** * Lookup the cache component with provided hint and create a new cache. * * @param <T> the class of the data stored in the cache. * @param config the cache configuration. * @param cacheHint the role hint to lookup. * @return a new {@link Cache}. * @throws CacheException error when creating the cache. */ public <T> Cache<T> createNewCache(CacheConfiguration config, String cacheHint) throws CacheException { CacheFactory cacheFactory; try { cacheFactory = this.componentManager.getInstance(CacheFactory.class, cacheHint); } catch (ComponentLookupException e) { throw new CacheException("Failed to get cache factory for role hint [" + cacheHint + "]", e); } return cacheFactory.newCache(config); } }