net.sf.ehcache.Cache.putAll()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中net.sf.ehcache.Cache.putAll()方法的一些代码示例,展示了Cache.putAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.putAll()方法的具体详情如下:
包路径:net.sf.ehcache.Cache
类名称:Cache
方法名:putAll

Cache.putAll介绍

暂无

代码示例

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException {
  putAll(elements, false);
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * {@inheritDoc}
 */
public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException {
  putAll(elements, false);
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * {@inheritDoc}
 */
public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException {
  putAll(elements, false);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * {@inheritDoc}
 */
public void putAll(Collection<Element> elements) throws IllegalArgumentException, IllegalStateException, CacheException {
  putAll(elements, false);
}

代码示例来源:origin: net.oschina.j2cache/j2cache-core

@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);
}

代码示例来源:origin: com.intuit.wasabi/wasabi-assignment

/**
 * 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;
}

相关文章

Cache类方法