org.infinispan.client.hotrod.near.BoundedConcurrentMapNearCache Maven / Gradle / Ivy
package org.infinispan.client.hotrod.near;
import org.infinispan.client.hotrod.VersionedValue;
import org.infinispan.client.hotrod.configuration.NearCacheConfiguration;
import org.infinispan.commons.util.CollectionFactory;
import java.util.concurrent.ConcurrentMap;
/**
* Near cache based on {@link BoundedConcurrentMapNearCache}
*
* @since 7.2
*/
final class BoundedConcurrentMapNearCache implements NearCache {
private final ConcurrentMap> cache;
private BoundedConcurrentMapNearCache(ConcurrentMap> cache) {
this.cache = cache;
}
public static NearCache create(final NearCacheConfiguration config) {
return new BoundedConcurrentMapNearCache(
CollectionFactory.>makeBoundedConcurrentMap(config.maxEntries()));
}
@Override
public void put(K key, VersionedValue value) {
cache.put(key, value);
}
@Override
public void putIfAbsent(K key, VersionedValue value) {
cache.putIfAbsent(key, value);
}
@Override
public void remove(K key) {
cache.remove(key);
}
@Override
public VersionedValue get(K key) {
return cache.get(key);
}
@Override
public void clear() {
cache.clear();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy