本文整理了Java中javax.cache.Cache.removeAll()
方法的一些代码示例,展示了Cache.removeAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.removeAll()
方法的具体详情如下:
包路径:javax.cache.Cache
类名称:Cache
方法名:removeAll
[英]Removes all of the mappings from this cache.
The order that the individual entries are removed is undefined.
For every mapping that exists the following are called:
This is potentially an expensive operation as listeners are invoked. Use #clear() to avoid this.
[中]从此缓存中删除所有映射。
单个条目的删除顺序未定义。
对于存在的每个映射,将调用以下内容:
*任何已注册的CacheEntryRemovedListeners
*如果缓存是直写缓存,则CacheWriter
如果缓存为空,则不会调用CacheWriter。
在调用侦听器时,这可能是一个昂贵的操作。使用#clear()可以避免这种情况。
代码示例来源:origin: spring-projects/spring-framework
@Override
public void clear() {
this.cache.removeAll();
}
代码示例来源:origin: org.springframework/spring-context-support
@Override
public void clear() {
this.cache.removeAll();
}
代码示例来源:origin: killbill/killbill
@Override
public void remove(final Function<K, Boolean> keyMatcher) {
final Set<K> toRemove = new HashSet<K>();
for (final Object key : getKeys()) {
if (keyMatcher.apply((K) key) == Boolean.TRUE) {
toRemove.add((K) key);
}
}
cache.removeAll(toRemove);
}
代码示例来源:origin: ehcache/ehcache3
@Test
public void removeAll() {
cache.put(1, "a");
cache.put(2, "b");
changesOf(0, 0, 2, 0);
cache.removeAll();
changesOf(0, 0, 0, 2);
}
代码示例来源:origin: ehcache/ehcache3
@Test
public void removeAllKeys() {
cache.put(1, "a");
cache.put(2, "b");
changesOf(0, 0, 2, 0);
cache.removeAll(asSet(1, 2, 3));
changesOf(0, 0, 0, 2);
}
代码示例来源:origin: ehcache/ehcache3
private void innerClear() {
cache.get(1); // one miss
cache.getAll(asSet(1, 2, 3)); // 3 misses
cache.put(1, "a"); // one put
cache.put(1, "b"); // one put and update
cache.putAll(Collections.singletonMap(2, "b")); // 1 put
cache.get(1); // one hit
cache.remove(1); // one remove
cache.removeAll(); // one remove
changesOf(1, 4, 3, 2);
cacheStatistics.clear();
changesOf(-1, -4, -3, -2);
}
}
代码示例来源:origin: org.pageseeder.bridge/pso-bridge
/**
* Remove all cache entries.
*/
@Override
public synchronized void removeAll() {
this._cacheById.removeAll();
Cache<String, Long> keyCache = this._cacheByKey;
if (keyCache != null) {
keyCache.removeAll();
}
}
代码示例来源:origin: cache2k/cache2k
@Override
public void removeAll() {
cache.removeAll();
}
代码示例来源:origin: org.apache.camel/camel-jcache
@Override
void execute(Cache<Object, Object> cache, Exchange exchange) {
Set<Object> keys = exchange.getIn().getHeader(JCacheConstants.KEYS, Set.class);
if (keys != null) {
cache.removeAll(keys);
} else {
cache.removeAll();
}
}
},
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.provider
/**
* Remove everything in the cache.
*/
public void clear() {
Cache<K, V> cache = getOpenIDCache();
if (cache != null) {
cache.removeAll();
}
}
代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.entitlement.proxy
void clear() {
if (simpleCache != null) {
simpleCache = new SimpleCache<>(simpleCache.maxEntries);
} else if (isCarbonCache) {
Cache<IdentityCacheKey, IdentityCacheEntry> carbonCache = getCommonCache();
if (carbonCache != null) {
carbonCache.removeAll();
}
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void clear() {
getCacheManager().getPropertiesCache().removeAll();
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void clear() {
getCacheManager().getFeaturesCache().removeAll();
}
代码示例来源:origin: org.wso2.carbon.devicemgt/org.wso2.carbon.policy.mgt.core
@Override
public void updateAllPolicies(List<Policy> policies) {
Cache<Integer, List<Policy>> lCache = getPolicyListCache();
lCache.removeAll();
lCache.put(1, policies);
}
void clear() {
if (simpleCache != null) {
simpleCache = new SimpleCache<>(simpleCache.maxEntries);
} else if (isCarbonCache) {
Cache<IdentityCacheKey, IdentityCacheEntry> carbonCache = getCommonCache();
if (carbonCache != null) {
carbonCache.removeAll();
}
}
}
代码示例来源:origin: wso2/carbon-identity-framework
/**
* Remove everything in the cache.
*/
public void clear() {
if (!isEnabled()) {
return;
}
Cache<K, V> cache = getBaseCache();
if (cache != null) {
cache.removeAll();
}
}
代码示例来源:origin: javax.cache/cache-tests
@Test
public void removeAll_1arg_NullKey() {
HashSet<Long> keys = new HashSet<Long>();
keys.add(null);
try {
cache.removeAll(keys);
fail("should have thrown an exception - null key not allowed");
} catch (NullPointerException e) {
//expected
}
}
代码示例来源:origin: org.apache.tomee.patch/commons-jcs-jcache
private void removeAll(final CacheKeyInvocationContext<CacheRemoveAll> context, final CacheDefaults defaults, final CacheRemoveAll cacheRemoveAll)
{
final Cache<Object, Object> cache = helper.cacheResolverFactoryFor(defaults, cacheRemoveAll.cacheResolverFactory()).getCacheResolver(context).resolveCache(context);
cache.removeAll();
}
}
代码示例来源:origin: javax.cache/cache-tests
@Test
public void removeAll_1arg_Null() {
try {
cache.removeAll(null);
fail("should have thrown an exception - null keys not allowed");
} catch (NullPointerException e) {
//good
}
}
代码示例来源:origin: javax.cache/cache-tests
@Test
public void removeAll_1arg_Closed() {
cache.close();
try {
cache.removeAll(null);
fail("should have thrown an exception - cache closed");
} catch (IllegalStateException e) {
//good
}
}
内容来源于网络,如有侵权,请联系作者删除!