Class EmbeddedSetCache<K,V>

java.lang.Object
org.infinispan.multimap.impl.EmbeddedSetCache<K,V>

public class EmbeddedSetCache<K,V> extends Object
SetCache with Set methods implementation
Since:
15.0
Author:
Vittorio Rigamonti
  • Field Details

    • ERR_KEY_CAN_T_BE_NULL

      public static final String ERR_KEY_CAN_T_BE_NULL
      See Also:
    • ERR_VALUE_CAN_T_BE_NULL

      public static final String ERR_VALUE_CAN_T_BE_NULL
      See Also:
    • readWriteMap

      protected final org.infinispan.functional.FunctionalMap.ReadWriteMap<K,SetBucket<V>> readWriteMap
    • cache

      protected final org.infinispan.AdvancedCache<K,SetBucket<V>> cache
    • entryFactory

      protected final org.infinispan.container.impl.InternalEntryFactory entryFactory
  • Constructor Details

    • EmbeddedSetCache

      public EmbeddedSetCache(org.infinispan.Cache<K,SetBucket<V>> cache)
  • Method Details

    • get

      public CompletionStage<SetBucket<V>> get(K key)
      Get the entry by key and return it as a set
      Parameters:
      key - , the name of the set
      Returns:
      the set with values if such exist, or null if the key is not present
    • getAsSet

      public CompletionStage<Set<V>> getAsSet(K key)
      Get the entry by key and return it as a set
      Parameters:
      key - , the name of the set
      Returns:
      the set with values if such exist, or null if the key is not present
    • add

      public CompletionStage<Long> add(K key, V value)
      Add the specified element to the set, creates the set in case
      Parameters:
      key - , the name of the set
      value - , the element to be inserted
      Returns:
      CompletionStage containing a Void
    • add

      public CompletionStage<Long> add(K key, Collection<V> values)
      Add the specified elements to the set, creates the set in case
      Parameters:
      key - , the name of the set
      value - , the element to be inserted
      Returns:
      CompletionStage containing a Void
    • remove

      public CompletionStage<Long> remove(K key, V value)
      Remove the specified element to the set, removes the set if empty
      Parameters:
      key - , the name of the set
      value - , the element to be inserted
      Returns:
      CompletionStage containing a Void
    • remove

      public CompletionStage<Long> remove(K key, Collection<V> values)
      Remove the specified elements from the set, remove the set if empty
      Parameters:
      key - , the name of the set
      value - , the element to be inserted
      Returns:
      CompletionStage containing a Void
    • getAll

      public CompletableFuture<Map<K,SetBucket<V>>> getAll(Set<K> keys)
      Get all the entries specified in the keys collection
      Parameters:
      keys - , collection of keys to be get
      Returns:
      CompletionStage containing a invalid input: '{@link /*missing*/}'
    • size

      public CompletionStage<Long> size(K key)
      Returns the number of elements in the set. If the entry does not exit, returns size 0.
      Parameters:
      key - , the name of the set
      Returns:
      CompletionStage containing a Long
    • set

      public CompletionStage<Long> set(K key, Collection<V> values)
      Create the set with given values
      Parameters:
      key - , the name of the set
      values - , the elements to be inserted
      Returns:
      CompletionStage containing the number of elements
    • pop

      public CompletionStage<Collection<V>> pop(K key, Long count, boolean remove)
      Return a collection representign a subset of the set
      Parameters:
      key - , the name of the set
      count - , the number of elements to return
      Returns:
      CompletionStage the random subset elements
    • contains

      public CompletionStage<Boolean> contains(K key, V element)
      Returns if a set contains an element
      Parameters:
      key - , the name of the set
      element - , the element
      Returns:
      CompletionStage containing a boolean