Class RemoteCacheImpl<K,​V>

    • Method Detail

      • init

        public void init​(org.infinispan.commons.marshall.Marshaller marshaller,
                         OperationsFactory operationsFactory,
                         int estimateKeySize,
                         int estimateValueSize,
                         int batchSize)
      • removeWithVersion

        public boolean removeWithVersion​(K key,
                                         long version)
        Description copied from interface: RemoteCache
        Removes the given entry only if its version matches the supplied version. A typical use case looks like this:
         VersionedEntry ve = remoteCache.getVersioned(key);
         //some processing
         remoteCache.removeWithVersion(key, ve.getVersion();
         
        Lat call (removeWithVersion) will make sure that the entry will only be removed if it hasn't been changed in between.
        Returns:
        true if the entry has been removed
        See Also:
        VersionedValue, RemoteCache.getVersioned(Object)
      • replaceWithVersion

        public boolean replaceWithVersion​(K key,
                                          V newValue,
                                          long version,
                                          int lifespanSeconds,
                                          int maxIdleTimeSeconds)
        Description copied from interface: RemoteCache
        A overloaded form of RemoteCache.replaceWithVersion(Object, Object, long) which takes in lifespan and maximum idle time parameters.
        Parameters:
        key - key to use
        newValue - new value to be associated with the key
        version - numeric version that should match the one in the server for the operation to succeed
        lifespanSeconds - lifespan of the entry
        maxIdleTimeSeconds - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        Returns:
        true if the value was replaced
      • replaceWithVersion

        public boolean replaceWithVersion​(K key,
                                          V newValue,
                                          long version,
                                          long lifespan,
                                          TimeUnit lifespanTimeUnit,
                                          long maxIdle,
                                          TimeUnit maxIdleTimeUnit)
        Description copied from interface: RemoteCache
        A overloaded form of RemoteCache.replaceWithVersion(Object, Object, long) which takes in lifespan and maximum idle time parameters.
        Parameters:
        key - key to use
        newValue - new value to be associated with the key
        version - numeric version that should match the one in the server for the operation to succeed
        lifespan - lifespan of the entry
        lifespanTimeUnit - TimeUnit for lifespan
        maxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - TimeUnit for maxIdle
        Returns:
        true if the value was replaced
      • replaceWithVersionAsync

        public CompletableFuture<Boolean> replaceWithVersionAsync​(K key,
                                                                  V newValue,
                                                                  long version,
                                                                  long lifespan,
                                                                  TimeUnit lifespanTimeUnit,
                                                                  long maxIdle,
                                                                  TimeUnit maxIdleTimeUnit)
      • retrieveEntries

        public org.infinispan.commons.util.CloseableIterator<Map.Entry<Object,​Object>> retrieveEntries​(String filterConverterFactory,
                                                                                                             Object[] filterConverterParams,
                                                                                                             Set<Integer> segments,
                                                                                                             int batchSize)
        Description copied from interface: RemoteCache
        Retrieve entries from the server
        Parameters:
        filterConverterFactory - Factory name for the KeyValueFilterConverter or null for no filtering.
        filterConverterParams - Parameters to the KeyValueFilterConverter
        segments - The segments to iterate. If null all segments will be iterated. An empty set will filter out all entries.
        batchSize - The number of entries transferred from the server at a time.
        Returns:
        Iterator for the entries
      • retrieveEntriesByQuery

        public org.infinispan.commons.util.CloseableIterator<Map.Entry<Object,​Object>> retrieveEntriesByQuery​(org.infinispan.query.dsl.Query filterQuery,
                                                                                                                    Set<Integer> segments,
                                                                                                                    int batchSize)
        Description copied from interface: RemoteCache
        Retrieve entries from the server matching a query.
        Parameters:
        filterQuery - Query
        segments - The segments to iterate. If null all segments will be iterated. An empty set will filter out all entries.
        batchSize - The number of entries transferred from the server at a time.
        Returns:
        CloseableIterator
      • retrieveEntriesWithMetadata

        public org.infinispan.commons.util.CloseableIterator<Map.Entry<Object,​MetadataValue<Object>>> retrieveEntriesWithMetadata​(Set<Integer> segments,
                                                                                                                                        int batchSize)
        Description copied from interface: RemoteCache
        Retrieve entries with metadata information
      • getVersioned

        public VersionedValue<V> getVersioned​(K key)
        Description copied from interface: RemoteCache
        Returns the VersionedValue associated to the supplied key param, or null if it doesn't exist.
      • getWithMetadata

        public MetadataValue<V> getWithMetadata​(K key)
        Description copied from interface: RemoteCache
        Returns the MetadataValue associated to the supplied key param, or null if it doesn't exist.
      • size

        public int size()
      • isEmpty

        public boolean isEmpty()
      • put

        public V put​(K key,
                     V value,
                     long lifespan,
                     TimeUnit lifespanUnit,
                     long maxIdleTime,
                     TimeUnit maxIdleTimeUnit)
      • putIfAbsent

        public V putIfAbsent​(K key,
                             V value,
                             long lifespan,
                             TimeUnit lifespanUnit,
                             long maxIdleTime,
                             TimeUnit maxIdleTimeUnit)
      • replace

        public V replace​(K key,
                         V value,
                         long lifespan,
                         TimeUnit lifespanUnit,
                         long maxIdleTime,
                         TimeUnit maxIdleTimeUnit)
      • containsKey

        public boolean containsKey​(Object key)
      • containsValue

        public boolean containsValue​(Object value)
      • get

        public V get​(Object key)
      • getAll

        public Map<K,​V> getAll​(Set<? extends K> keys)
        Description copied from interface: RemoteCache
        Retrieves all of the entries for the provided keys. A key will not be present in the resulting map if the entry was not found in the cache.
        Parameters:
        keys - The keys to find values for
        Returns:
        The entries that were present for the given keys
      • getBulk

        public Map<K,​V> getBulk()
        Description copied from interface: RemoteCache
        Bulk get operations, returns all the entries within the remote cache.
        Returns:
        the returned values depend on the configuration of the back-end infinispan servers. Read this for more details. The returned Map is unmodifiable.
      • getBulk

        public Map<K,​V> getBulk​(int size)
        Description copied from interface: RemoteCache
        Same as RemoteCache.getBulk(), but limits the returned set of values to the specified size. No ordering is guaranteed, and there is no guarantee that "size" elements are returned( e.g. if the number of elements in the back-end server is smaller that "size")
      • clear

        public void clear()
      • start

        public void start()
      • stop

        public void stop()
      • getName

        public String getName()
      • getVersion

        public String getVersion()
      • getProtocolVersion

        public String getProtocolVersion()
        Description copied from interface: RemoteCache
        Returns the HotRod protocol version supported by this RemoteCache implementation
      • addClientListener

        public void addClientListener​(Object listener)
        Description copied from interface: RemoteCache
        Add a client listener to receive events that happen in the remote cache. The listener object must be annotated with @ClientListener annotation.
      • addClientListener

        public void addClientListener​(Object listener,
                                      Object[] filterFactoryParams,
                                      Object[] converterFactoryParams)
        Description copied from interface: RemoteCache
        Add a client listener to receive events that happen in the remote cache. The listener object must be annotated with @ClientListener annotation.
      • removeClientListener

        public void removeClientListener​(Object listener)
        Description copied from interface: RemoteCache
        Remove a previously added client listener. If the listener was not added before, this operation is a no-op.
      • getListeners

        public Set<Object> getListeners()
        Description copied from interface: RemoteCache
        Returns a set with all the listeners registered by this client for the given cache.
      • withFlags

        public RemoteCache<K,​V> withFlags​(Flag... flags)
        Description copied from interface: RemoteCache
        Applies one or more Flags to the scope of a single invocation. See the Flag enumeration to for information on available flags.

        Sample usage:

            remoteCache.withFlags(Flag.FORCE_RETURN_VALUE).put("hello", "world");
         
        Returns:
        the current RemoteCache instance to continue running operations on.
      • keyToBytes

        protected byte[] keyToBytes​(Object o)
      • valueToBytes

        protected byte[] valueToBytes​(Object o)
      • assertRemoteCacheManagerIsStarted

        protected void assertRemoteCacheManagerIsStarted()
      • set

        protected void set​(K key,
                           V value)
        Description copied from class: RemoteCacheSupport
        This is intentionally a non-public method meant as an integration point for bytecode manipulation. Don't remove or alter the signature even if it might look like unreachable code. Implementors should perform a put operation but optimizing it as return values are not required.
        Specified by:
        set in class RemoteCacheSupport<K,​V>
      • keySet

        public org.infinispan.commons.util.CloseableIteratorSet<K> keySet()
      • entrySet

        public org.infinispan.commons.util.CloseableIteratorSet<Map.Entry<K,​V>> entrySet()
      • values

        public org.infinispan.commons.util.CloseableIteratorCollection<V> values()
      • execute

        public <T> T execute​(String taskName,
                             Map<String,​?> params)
        Description copied from interface: RemoteCache
        Executes a remote script passing a set of named parameters
      • execute

        public <T> T execute​(String taskName,
                             Map<String,​?> params,
                             Object key)
        Description copied from interface: RemoteCache
        Executes a remote script passing a set of named parameters, hinting that the script should be executed on the server that is expected to store given key. The key itself is not transferred to the server.
      • hasCompatibility

        public boolean hasCompatibility()