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

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

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

Cache.removeAll介绍

[英]Removes all cached items. Terracotta clustered caches may require more time to execute this operation because cached items must also be removed from the Terracotta Server Array. Synchronization is handled within the method.

Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails. This exception should be caught in those circumstances.
[中]删除所有缓存项。Terracotta群集缓存可能需要更多时间来执行此操作,因为缓存项也必须从Terracotta服务器阵列中删除。同步是在方法中处理的。
如果到群集的复制失败,则使用同步复制的缓存可以在此处引发RemoteCacheException。在这些情况下,应抓住这一例外。

代码示例

代码示例来源:origin: ninjaframework/ninja

public void clear() {
  ehCache.removeAll();
}

代码示例来源:origin: javamelody/javamelody

private void clearCache(String cacheId) {
  final List<CacheManager> allCacheManagers = CacheManager.ALL_CACHE_MANAGERS;
  for (final CacheManager cacheManager : allCacheManagers) {
    final Cache cache = cacheManager.getCache(cacheId);
    if (cache != null) {
      cache.removeAll();
    }
  }
}

代码示例来源:origin: shuzheng/zheng

/**
 * 删除全部缓存记录
 * @param cacheName
 * @return
 */
public static void removeAll(String cacheName) {
  Cache cache = getCache(cacheName);
  if (null != cache) {
    cache.removeAll();
  }
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public void clearAdminSecurityCache() {
  if (LOG.isTraceEnabled()) {
    LOG.trace("Admin Security Cache DELETE");
  }
  cache.removeAll();
}

代码示例来源:origin: jfinal/jfinal

public static void removeAll(String cacheName) {
  getOrAddCache(cacheName).removeAll();
}

代码示例来源:origin: stylefeng/Guns

public static void removeAll(String cacheName) {
  getOrAddCache(cacheName).removeAll();
}

代码示例来源:origin: apache/kylin

public void cleanDataCache(String project) {
  if (cacheManager != null) {
    if (getConfig().isQueryCacheSignatureEnabled()) {
      logger.info("cleaning cache for project " + project + " (currently remove nothing)");
    } else {
      logger.info("cleaning cache for project " + project + " (currently remove all entries)");
      cacheManager.getCache(QueryService.QUERY_CACHE).removeAll();
    }
  } else {
    logger.warn("skip cleaning cache for project " + project);
  }
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

/**
 * Remove all items from the underlying cache - a complete clear
 *
 * @param cacheName the name of the cache - the ehcache region name
 */
protected void clearCache(String cacheName) {
  if (getLogger().isTraceEnabled()) {
    getLogger().trace("Evicting all keys from the [" + cacheName + "] cache.");
  }
  getCache(cacheName).removeAll();
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

/**
 * Clear out the cache since the SystemPropertiesService/Dao will have cached a not found
 */
protected void clearSystemPropertiesCache() {
  try {
    Method m = AbstractCacheMissAware.class.getDeclaredMethod("getCache", new Class<?>[] {String.class});
    m.setAccessible(true);
    Cache cache = (Cache) m.invoke(propsDao, "blSystemPropertyNullCheckCache");
    cache.removeAll();
    m = SystemPropertiesServiceImpl.class.getDeclaredMethod("getSystemPropertyCache");
    m.setAccessible(true);
    cache = (Cache) m.invoke(propsSvc);
    cache.removeAll();
  } catch (NoSuchMethodException|SecurityException|IllegalAccessException|IllegalArgumentException|InvocationTargetException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: primefaces/primefaces

@Override
public void clear() {
  String[] cacheNames = getCacheManager().getCacheNames();
  if (cacheNames != null) {
    for (String cacheName : cacheNames) {
      Cache cache = getRegion(cacheName);
      cache.removeAll();
    }
  }
}

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

/**
 * Removes all cached items.
 * Terracotta clustered caches may require more time to execute this operation because cached items must also be removed from the Terracotta Server Array. Synchronization is handled within the method.
 * <p>
 * Caches which use synchronous replication can throw RemoteCacheException here if the replication to the cluster fails.
 * This exception should be caught in those circumstances.
 *
 * @throws IllegalStateException if the cache is not {@link Status#STATUS_ALIVE}
 */
public void removeAll() throws IllegalStateException, CacheException {
  removeAll(false);
}

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

/**
 * {@inheritDoc}
 */
public void removeAll(final Collection<?> keys) throws IllegalStateException {
  removeAll(keys, false);
}

代码示例来源:origin: Impetus/Kundera

@Override
public void evictAll()
{
  if(isAlive())
  {
    ehcache.removeAll();
  }
}

代码示例来源:origin: banq/jdonframework

public void clear() {
  if (manager != null) {
    Cache cache = manager
        .getCache(ehcacheConf.getPredefinedCacheName());
    cache.removeAll();
  }
}

代码示例来源:origin: gravitee-io/gravitee-gateway

@Override
protected void doStop() throws Exception {
  if (enabled) {
    super.doStop();
    if (executorService != null) {
      executorService.shutdown();
    }
    LOGGER.info("Clear API keys from in-memory cache before stopping service");
    cache.removeAll();
    cache.dispose();
  }
}

代码示例来源:origin: gravitee-io/gravitee-gateway

@Override
protected void doStop() throws Exception {
  if (enabled) {
    super.doStop();
    if (executorService != null) {
      executorService.shutdown();
    }
    LOGGER.info("Clear subscriptions from cache before stopping service");
    cache.removeAll();
    cache.dispose();
  }
}

代码示例来源:origin: banq/jdonframework

public void stop() {
  Cache cache = manager.getCache(ehcacheConf.getPredefinedCacheName());
  cache.removeAll();
  manager.removeCache(ehcacheConf.getPredefinedCacheName());
  manager.removalAll();
  manager.clearAll();
  manager.shutdown();
  manager = null;
}

代码示例来源:origin: vakinge/jeesuite-libs

@Override
public void clearAll() {
  for (Cache cache : caches.values()) {
    cache.removeAll();
  }
}

代码示例来源:origin: ff4j/ff4j

/** {@inheritDoc} */
  @Override
  public void clear() {
    wrapper.getCacheFeatures().removeAll();
  }    
}

代码示例来源:origin: ff4j/ff4j

/** {@inheritDoc} */
@Override
public void clear() {
  wrapper.getCacheProperties().removeAll();
}

相关文章

Cache类方法