Class JCacheDistributedMapAdapter<K,V>

java.lang.Object
com.loomcache.server.jcache.JCacheDistributedMapAdapter<K,V>

public final class JCacheDistributedMapAdapter<K,V> extends Object
Adapter that exposes either a local DistributedMap or the real cluster protocol path as a typed <K, V> store for JCache.
  • Constructor Details

  • Method Details

    • create

      public static <K,V> JCacheDistributedMapAdapter<K,V> create(DataStructureRegistry registry, KryoSerializer serializer, String cacheName, Class<K> keyType, Class<V> valueType)
      Convenience factory that looks up (or creates) the underlying DistributedMap via the given registry.
    • create

      public static <K,V> JCacheDistributedMapAdapter<K,V> create(DataStructureRegistry registry, KryoSerializer serializer, String cacheName, Class<K> keyType, Class<V> valueType, Collection<Class<?>> allowedEmbeddedTypes)
      Create an adapter with additional embedded payload types allowed for Object-typed caches. The adapter never resolves type names from storage; only classes supplied here, configured key/value types, and a small stable JDK set may appear in the encoded header.
    • createProtocolBacked

      public static <K,V> JCacheDistributedMapAdapter<K,V> createProtocolBacked(com.loomcache.server.jcache.LoomJCacheClusterClient clusterClient, KryoSerializer serializer, String cacheName, Class<K> keyType, Class<V> valueType)
      Factory for the protocol-backed path used by node-owned providers.
    • jcacheMapName

      public static String jcacheMapName(String cacheName)
      Qualified backing-map name so JCache caches do not collide with plain DistributedMap instances that happen to share the cache name.
    • hasBackingMap

      public boolean hasBackingMap()
    • getBackingMap

      public DistributedMap<String,String> getBackingMap()
      Returns:
      the underlying DistributedMap — primarily for diagnostics/tests
    • put

      public void put(K key, V value)
    • get

      public @Nullable V get(K key)
    • remove

      public boolean remove(K key)
    • remove

      public boolean remove(K key, V expectedValue)
    • containsKey

      public boolean containsKey(K key)
    • clear

      public void clear()
    • size

      public int size()
    • keySet

      public Set<K> keySet()
    • entries

      public Map<K,V> entries()
    • putIfAbsent

      public boolean putIfAbsent(K key, V value)
    • replace

      public @Nullable V replace(K key, V value)
    • replace

      public boolean replace(K key, V oldValue, V newValue)
    • getAndPut

      public @Nullable V getAndPut(K key, V value)
    • getAndRemove

      public @Nullable V getAndRemove(K key)
    • wrapTypedMapStore

      public MapStore<String,String> wrapTypedMapStore(MapStore<K,V> typedStore)
      Wrap a typed MapStore so it can be installed on the encoded backing map.