
org.infinispan.hotrod.HotRodAsyncCaches Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infinispan-hotrod-jakarta Show documentation
Show all versions of infinispan-hotrod-jakarta Show documentation
Infinispan Hot Rod Client Jakarta EE
package org.infinispan.hotrod;
import java.util.Set;
import java.util.concurrent.CompletionStage;
import org.infinispan.api.async.AsyncCache;
import org.infinispan.api.async.AsyncCaches;
import org.infinispan.api.configuration.CacheConfiguration;
import org.infinispan.hotrod.configuration.RemoteCacheConfiguration;
import org.infinispan.hotrod.impl.cache.RemoteCache;
/**
* @since 14.0
**/
public class HotRodAsyncCaches implements AsyncCaches {
private final HotRod hotrod;
HotRodAsyncCaches(HotRod hotrod) {
this.hotrod = hotrod;
}
@Override
public CompletionStage> create(String name, CacheConfiguration cacheConfiguration) {
RemoteCacheConfiguration configuration = RemoteCacheConfiguration.fromCacheConfiguration(name, cacheConfiguration);
return hotrod.transport.getRemoteCache(name, configuration).thenApply(r -> new HotRodAsyncCache<>(hotrod, (RemoteCache) r));
}
@Override
public CompletionStage> create(String name, String template) {
RemoteCacheConfiguration configuration = RemoteCacheConfiguration.fromTemplate(name, template);
return hotrod.transport.getRemoteCache(name, configuration).thenApply(r -> new HotRodAsyncCache<>(hotrod, (RemoteCache) r));
}
@Override
public CompletionStage> get(String name) {
return hotrod.transport.getRemoteCache(name).thenApply(r -> new HotRodAsyncCache<>(hotrod, (RemoteCache) r));
}
@Override
public CompletionStage remove(String name) {
return hotrod.transport.removeCache(name);
}
@Override
public CompletionStage> names() {
return hotrod.transport.getCacheNames();
}
@Override
public CompletionStage createTemplate(String name, CacheConfiguration cacheConfiguration) {
return null;
}
@Override
public CompletionStage removeTemplate(String name) {
return null;
}
@Override
public CompletionStage> templateNames() {
return hotrod.transport.getTemplateNames();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy