Skip navigation links
Infinispan JavaDoc 8.4.0.Final-redhat-2
org.infinispan.client.hotrod

Interface RemoteCache<K,V>

    • Method Detail

      • removeWithVersion

        boolean removeWithVersion(K key,
                                  long version)
        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, getVersioned(Object)
      • replaceWithVersion

        boolean replaceWithVersion(K key,
                                   V newValue,
                                   long version)
        Replaces the given value only if its version matches the supplied version. See removeWithVersion(Object, long) for a sample usage of the version-based methods.
        Parameters:
        version - numeric version that should match the one in the server for the operation to succeed
        Returns:
        true if the value has been replaced
        See Also:
        getVersioned(Object), VersionedValue
      • replaceWithVersion

        boolean replaceWithVersion(K key,
                                   V newValue,
                                   long version,
                                   int lifespanSeconds)
        A overloaded form of replaceWithVersion(Object, Object, long) which takes in lifespan 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
        Returns:
        true if the value was replaced
      • replaceWithVersion

        boolean replaceWithVersion(K key,
                                   V newValue,
                                   long version,
                                   int lifespanSeconds,
                                   int maxIdleTimeSeconds)
        A overloaded form of 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

        boolean replaceWithVersion(K key,
                                   V newValue,
                                   long version,
                                   long lifespan,
                                   TimeUnit lifespanTimeUnit,
                                   long maxIdle,
                                   TimeUnit maxIdleTimeUnit)
        A overloaded form of 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
      • retrieveEntries

        CloseableIterator<Map.Entry<Object,Object>> retrieveEntries(String filterConverterFactory,
                                                                    Object[] filterConverterParams,
                                                                    Set<Integer> segments,
                                                                    int batchSize)
        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

        CloseableIterator<Map.Entry<Object,Object>> retrieveEntriesByQuery(Query filterQuery,
                                                                           Set<Integer> segments,
                                                                           int batchSize)
        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
      • getWithMetadata

        MetadataValue<V> getWithMetadata(K key)
        Returns the MetadataValue associated to the supplied key param, or null if it doesn't exist.
      • keySet

        Set<K> keySet()
        Returns all keys in the remote server. It'll invoke a command over the network each time this method is called. If the remote cache is a distributed cache, it will retrieve all of the keys from all nodes in the cluster. Please use with care for cache with large data set.
        Specified by:
        keySet in interface Map<K,V>
      • putAll

        void putAll(Map<? extends K,? extends V> map,
                    long lifespan,
                    TimeUnit unit)
        Synthetic operation. The client iterates over the set of keys and calls put for each one of them. This results in operation not being atomic (if a failure happens after few puts it is not rolled back) and costly (for each key in the parameter map a remote call is performed).
        Specified by:
        putAll in interface BasicCache<K,V>
        Parameters:
        map - map containing mappings to enter
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        unit - unit of measurement for the lifespan
      • putAll

        void putAll(Map<? extends K,? extends V> map,
                    long lifespan,
                    TimeUnit lifespanUnit,
                    long maxIdleTime,
                    TimeUnit maxIdleTimeUnit)
        Synthetic operation.
        Specified by:
        putAll in interface BasicCache<K,V>
        Parameters:
        map - map containing mappings to enter
        lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
        lifespanUnit - time unit for lifespan
        maxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as expired
        maxIdleTimeUnit - time unit for max idle time
        See Also:
        putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
      • withFlags

        RemoteCache<K,V> withFlags(Flag... flags)
        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");
         
        Parameters:
        flags -
        Returns:
        the current RemoteCache instance to continue running operations on.
      • getBulk

        @Deprecated
        Map<K,V> getBulk()
        Deprecated. Bulk retrievals can be quite expensive if for large data sets. Alternatively, the different retrieveEntries* methods offer lazy, pull-style, methods that retrieve bulk data more efficiently.
        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

        @Deprecated
        Map<K,V> getBulk(int size)
        Deprecated. Bulk retrievals can be quite expensive if for large data sets. Alternatively, the different retrieveEntries* methods offer lazy, pull-style, methods that retrieve bulk data more efficiently.
        Same as 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")
      • getAll

        Map<K,V> getAll(Set<? extends K> keys)
        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
      • getProtocolVersion

        String getProtocolVersion()
        Returns the HotRod protocol version supported by this RemoteCache implementation
      • addClientListener

        void addClientListener(Object listener)
        Add a client listener to receive events that happen in the remote cache. The listener object must be annotated with @ClientListener annotation.
      • addClientListener

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

        void removeClientListener(Object listener)
        Remove a previously added client listener. If the listener was not added before, this operation is a no-op.
      • getListeners

        Set<Object> getListeners()
        Returns a set with all the listeners registered by this client for the given cache.
      • execute

        <T> T execute(String scriptName,
                      Map<String,?> params)
        Executes a remote script passing a set of named parameters
---> -

Copyright © 2017 JBoss, a division of Red Hat. All rights reserved.