/** * {@inheritDoc} */ public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException { putAll(elements, false); }
/** * {@inheritDoc} */ public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException { putAll(elements, false); }
/** * {@inheritDoc} */ public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException { putAll(elements, false); }
/** * {@inheritDoc} */ public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException { putAll(elements, false); }
@Override public void put(Map<String, Object> elements) { List<Element> elems = new ArrayList<>(); elements.forEach((k,v) -> elems.add(new Element(k,v))); cache.putAll(elems); }
/** * This method refresh the existing cache (keys) with the updated data from Database. * <p> * This method doesn't add new keys into the cache. * * @return TRUE if cache is successfully refreshed else FALSE. */ @Override public boolean refresh() { //------------------------------------------------------------------------------------------------ //Get updated data from database for each caches //------------------------------------------------------------------------------------------------ List<Element> appToExperiments = makeElementsList(experimentRepository.getExperimentsForApps(keys(APP_NAME_TO_EXPERIMENTS_CACHE))); List<Element> expIdsToExperiments = makeElementsList(experimentRepository.getExperimentsMap(keys(EXPERIMENT_ID_TO_EXPERIMENT_CACHE))); List<Element> appToPrioritizedExperiments = makeElementsList(prioritiesRepository.getPriorities(keys(APP_NAME_TO_PRIORITIZED_EXPERIMENTS_CACHE))); List<Element> expIdsToExclusions = makeElementsList(mutexRepository.getExclusivesList(keys(EXPERIMENT_ID_TO_EXCLUSION_CACHE))); List<Element> expIdsToBuckets = makeElementsList(experimentRepository.getBucketList(keys(EXPERIMENT_ID_TO_BUCKET_CACHE))); List<Element> appNPageToExperiments = makeElementsList(pagesRepository.getExperimentsWithoutLabels(keys(APP_NAME_N_PAGE_TO_EXPERIMENTS_CACHE))); //------------------------------------------------------------------------------------------------ //Now update individual caches //------------------------------------------------------------------------------------------------ cacheManager.getCache(APP_NAME_TO_EXPERIMENTS_CACHE.toString()).putAll(appToExperiments); cacheManager.getCache(EXPERIMENT_ID_TO_EXPERIMENT_CACHE.toString()).putAll(expIdsToExperiments); cacheManager.getCache(APP_NAME_TO_PRIORITIZED_EXPERIMENTS_CACHE.toString()).putAll(appToPrioritizedExperiments); cacheManager.getCache(EXPERIMENT_ID_TO_EXCLUSION_CACHE.toString()).putAll(expIdsToExclusions); cacheManager.getCache(EXPERIMENT_ID_TO_BUCKET_CACHE.toString()).putAll(expIdsToBuckets); cacheManager.getCache(APP_NAME_N_PAGE_TO_EXPERIMENTS_CACHE.toString()).putAll(appNPageToExperiments); LOGGER.debug("Assignments metadata cache has been refreshed successfully..."); return Boolean.TRUE; }