All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.client.hotrod.near.ConcurrentMapNearCache Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.client.hotrod.near;

import java.util.concurrent.ConcurrentMap;

import org.infinispan.client.hotrod.VersionedValue;
import org.infinispan.commons.util.CollectionFactory;

/**
 * A concurrent-map-based near cache implementation.
 * It does not provide eviction capabilities.
 *
 * @since 7.1
 */
final class ConcurrentMapNearCache implements NearCache {

   private final ConcurrentMap> cache = CollectionFactory.makeConcurrentMap();

   @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(Object key) {
      return cache.get(key);
   }

   @Override
   public void clear() {
      cache.clear();
   }

   public static  NearCache create() {
      return new ConcurrentMapNearCache();
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy