本文整理匯總了Java中org.infinispan.Cache.keySet方法的典型用法代碼示例。如果您正苦於以下問題:Java Cache.keySet方法的具體用法?Java Cache.keySet怎麽用?Java Cache.keySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.infinispan.Cache
的用法示例。
在下文中一共展示了Cache.keySet方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getKeysAddresses
import org.infinispan.Cache; //導入方法依賴的package包/類
public <K> Map<K, List<Address>> getKeysAddresses(Cache<K, Object> cache) {
DistributionManager distributionManager = cache.getAdvancedCache().getDistributionManager();
Map<K, List<Address>> response = new HashMap<>();
for(K k : cache.keySet()) {
response.put(k, distributionManager.locate(k));
}
return response;
}
示例2: valuesFromKeys
import org.infinispan.Cache; //導入方法依賴的package包/類
private Set<String> valuesFromKeys(Cache<Key, Object> cache,
Predicate<Key> predicate) {
Set<String> response = new HashSet<>();
for(Key k : cache.keySet()) {
if(predicate.test(k)) {
response.add(k + " " + cache.get(k));
}
}
return response;
}
示例3: valuesFromKeys
import org.infinispan.Cache; //導入方法依賴的package包/類
private static Set<String> valuesFromKeys(Cache<Long, Value> cache, Filter filter) {
Set<String> values = new HashSet<String>();
for (Long l : cache.keySet()) {
switch (filter) {
case ALL:
values.add(l + " " + cache.get(l));
break;
case LOCAL:
if (checkIfKeyIsLocalInCache(cache, l)) {
values.add(l + " " + cache.get(l));
}
break;
case PRIMARY:
if (checkIfCacheIsPrimaryFor(cache, l)) {
values.add(l + " " + cache.get(l));
}
break;
case REPLICA:
if (checkIfCacheIsSecondaryFor(cache, l)) {
values.add(l + " " + cache.get(l));
}
break;
}
}
return values;
}
示例4: viewChanged
import org.infinispan.Cache; //導入方法依賴的package包/類
@ViewChanged
public void viewChanged(ViewChangedEvent event) {
final Cache<String, ExecutionControl> cache = GlobalCache.get().getExecutionControls();
Set<String> allExecCtrls = new HashSet<>(cache.keySet());
for (String name : allExecCtrls) {
ExecutionControl ctrl = cache.get(name);
if (ctrl != null)
ctrl.onTimeout(-1);
}
}