Java Code Examples for org.infinispan.Cache#keySet()

The following examples show how to use org.infinispan.Cache#keySet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JDGUtility.java    From hacep with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 2
Source File: JDGUtility.java    From hacep with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: AbstractSessionCacheCommand.java    From keycloak with Apache License 2.0 5 votes vote down vote up
@Override
protected void doRunCacheCommand(KeycloakSession session, Cache<String, SessionEntityWrapper> cache) {
    for (String id : cache.keySet()) {
        SessionEntity entity = cache.get(id).getEntity();
        if (!(entity instanceof UserSessionEntity)) {
            continue;
        }
        UserSessionEntity userSession = (UserSessionEntity) cache.get(id).getEntity();
        log.info("list: key=" + id + ", value=" + toString(userSession));
    }
}