Infinispan HotRod C++ Client  8.3.1.Final
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Friends | List of all members
infinispan::hotrod::RemoteCache< K, V > Class Template Reference

#include <CacheClientListener.h>

Inheritance diagram for infinispan::hotrod::RemoteCache< K, V >:

Public Member Functions

std::string getName ()
 
std::string getVersion ()
 
std::string getProtocolVersion ()
 
V * get (const K &key)
 
std::map< std::shared_ptr< K >
, std::shared_ptr< V > > 
getAll (const std::set< K > &keySet)
 
std::future< V * > getAsync (const K &key, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
V * put (const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
 
V * put (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
 
V * put (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
 
std::future< V * > putAsync (const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > putAsync (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > putAsync (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
V * putIfAbsent (const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
 
V * putIfAbsent (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
 
V * putIfAbsent (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
 
std::future< V * > putIfAbsentAsync (const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > putIfAbsentAsync (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > putIfAbsentAsync (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
void putAll (const std::map< K, V > &map, uint64_t lifespan=0, uint64_t maxIdle=0)
 
void putAll (const std::map< K, V > &map, uint64_t lifespan, TimeUnit lifespanUnit)
 
void putAll (const std::map< K, V > &map, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
 
std::future< void > putAllAsync (const std::map< K, V > &map, uint64_t lifespan=0, uint64_t maxIdle=0, std::function< void()> success=nullptr, std::function< void(std::exception &)> fail=nullptr)
 
std::future< void > putAllAsync (const std::map< K, V > &map, uint64_t lifespan, TimeUnit lifespanUnit, std::function< void(void)> success=nullptr, std::function< void(std::exception &)> fail=nullptr)
 
std::future< void > putAllAsync (const std::map< K, V > &map, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit, std::function< void(void)> success=nullptr, std::function< void(std::exception &)> fail=nullptr)
 
V * replace (const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
 
V * replace (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
 
V * replace (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
 
V * replace (const K &key, const V &oldVal, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
 
V * replace (const K &key, const V &oldVal, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
 
V * replace (const K &key, const V &oldVal, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
 
std::future< V * > replaceAsync (const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > replaceAsync (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > replaceAsync (const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > replaceAsync (const K &key, const V &oldVal, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
std::future< V * > replaceAsync (const K &key, const V &oldVal, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
V * remove (const K &key)
 
std::future< V * > removeAsync (const K &key, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
 
bool containsKey (const K &key)
 
bool containsValue (const V &val)
 
bool replaceWithVersion (const K &key, const V &val, uint64_t version, uint64_t lifespan=0, uint64_t maxIdle=0)
 
std::future< bool > replaceWithVersionAsync (const K &key, const V &val, uint64_t version, uint64_t lifespan, uint64_t maxIdle, std::function< bool(bool)> success=nullptr, std::function< bool(std::exception &)> fail=nullptr)
 
bool removeWithVersion (const K &key, uint64_t version)
 
std::future< bool > removeWithVersionAsync (const K &key, uint64_t version, std::function< bool(bool)> success=nullptr, std::function< bool(std::exception &)> fail=nullptr)
 
std::pair< std::shared_ptr< V >
, VersionedValue
getWithVersion (const K &key)
 
std::pair< std::shared_ptr< V >
, MetadataValue
getWithMetadata (const K &key)
 
std::map< std::shared_ptr< K >
, std::shared_ptr< V > > 
getBulk ()
 
std::map< std::shared_ptr< K >
, std::shared_ptr< V > > 
getBulk (int nrOfEntries)
 
std::vector< unsigned char > execute (const std::string &name, const std::map< std::string, std::string > &args)
 
std::vector< unsigned char > execute (const std::string &name, const std::map< std::vector< char >, std::vector< char > > &args)
 
QueryResponse query (const QueryRequest &qr)
 
std::vector< unsigned char > query (std::vector< unsigned char > qr, size_t size)
 
std::set< std::pair< K, V > > entrySet ()
 
std::set< std::shared_ptr< K > > keySet ()
 
uint64_t size ()
 
bool isEmpty ()
 
std::vector< V > values ()
 
std::map< std::string,
std::string > 
stats ()
 
void clear ()
 
std::future< void > clearAsync (std::function< void(void)> success=nullptr, std::function< void(std::exception &)> fail=nullptr)
 
void ping ()
 
void addClientListener (ClientListener &clientListener, std::vector< std::vector< char > > filterFactoryParams, std::vector< std::vector< char > > converterFactoryParams, const std::function< void()> &recoveryCallback=nullptr)
 
void removeClientListener (ClientListener &clientListener)
 
void addContinuousQueryListener (ContinuousQueryListener< K, V > &cql)
 
template<typename... Params>
void addContinuousQueryListener (ContinuousQueryListener< K, V, Params...> &cql)
 
template<typename... Params>
void removeContinuousQueryListener (ContinuousQueryListener< Params...> &cql)
 
CacheTopologyInfo getCacheTopologyInfo ()
 
RemoteCache< K, V > & withFlags (Flag flags)
 
template<class M = JBossMarshaller>
RemoteExecution< M > getRemoteExecution ()
 
 RemoteCache (const RemoteCache &other)
 
RemoteCache withDataFormat (DataFormat< K, V > *df)
 
template<class K1 , class V1 >
RemoteCache< K1, V1 > withDataFormat (DataFormat< K1, V1 > *df)
 

Protected Member Functions

 RemoteCache (const RemoteCacheBase &rcb)
 
 RemoteCache (TransactionManager &tm, TransactionTable &tt, bool forceReturnValue, bool transactional)
 

Friends

class RemoteCacheManager
 
template<class K1 , class V1 >
class RemoteCache
 

Detailed Description

template<class K, class V>
class infinispan::hotrod::RemoteCache< K, V >

Provides remote reference to a cache residing on a Hot Rod server/cluster.

RemoteCache is intended to be similar to Infinispan Java RemoteCache interface as much as possible. Just like RemoteCache interface in its Java HotRod counterpart RemoteCache features:

New methods: Although some methods are very simila to Java Map interface, RemoteCache also adds new methods to optimize/reduce network traffic: e.g. versioned put operation.

Concurrency: implementations will support multi-threaded access.

Return values: previously existing values for certain methods are not returned, NULL is returned instead unless method is using fluent variant withFlags (see below).

Synthetic methods: aggregate methods are being implemented based on other Hot Rod operations. For example, putAll method is implemented using multiple individual puts. Therefore these methods are not atomic and that they are costly, e.g. as the number of network round-trips is not one, but the size of the added map.

It is possible change the default method behavior using Flag enum. For example:

     RemoteCache cache = ...;
     std::auto_ptr<std::string> rv(cache.withFlags(FORCE_RETURN_VALUE).put(k,v));

In the previous example Flag enum FORCE_RETURN_VALUE will make the client to also return previously existing value associated with k key. If this flag would not be present, RemoteCache would return (by default) NULL. This is in order to avoid fetching a possibly large object from the remote server, which might not be needed.

Constructor & Destructor Documentation

template<class K, class V>
infinispan::hotrod::RemoteCache< K, V >::RemoteCache ( const RemoteCache< K, V > &  other)
inline
template<class K, class V>
infinispan::hotrod::RemoteCache< K, V >::RemoteCache ( const RemoteCacheBase &  rcb)
inlineprotected
template<class K, class V>
infinispan::hotrod::RemoteCache< K, V >::RemoteCache ( TransactionManager tm,
TransactionTable tt,
bool  forceReturnValue,
bool  transactional 
)
inlineprotected

Member Function Documentation

template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::addClientListener ( ClientListener clientListener,
std::vector< std::vector< char > >  filterFactoryParams,
std::vector< std::vector< char > >  converterFactoryParams,
const std::function< void()> &  recoveryCallback = nullptr 
)
inline

Start client listener and register it on the server

Parameters
clientListenerobject defining the listener, filter and converter and the callback funcs
filterFactoryParamsparameters for optional server filter setup
converterFactoryParamsparameter for optional server converter setup
recoveryCallbackfunction to be called if transport goes down
Returns
template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::addContinuousQueryListener ( ContinuousQueryListener< K, V > &  cql)
inline

Start a client listener on the specified query and register it on the server

Parameters
cqlobject defining the query to be observed
template<class K, class V>
template<typename... Params>
void infinispan::hotrod::RemoteCache< K, V >::addContinuousQueryListener ( ContinuousQueryListener< K, V, Params...> &  cql)
inline

Start a client listener on a query that returns projection or aggregate and register it on the server

Parameters
cqlobject defining the query to be observed
template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::clear ( )
inline

Clears all entries in this cache

template<class K, class V>
std::future<void> infinispan::hotrod::RemoteCache< K, V >::clearAsync ( std::function< void(void)>  success = nullptr,
std::function< void(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of clear() See the synchronous doc for parameters not explained here

Parameters
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a bool. True if the entry has been removed
template<class K, class V>
bool infinispan::hotrod::RemoteCache< K, V >::containsKey ( const K &  key)
inline

Returns true if this cache contains a key/value pair where the key is equal to a specified key.

Parameters
keythe key
Returns
true if such key is present in this cache
template<class K, class V>
bool infinispan::hotrod::RemoteCache< K, V >::containsValue ( const V &  val)
inline

Unsupported operation in this release of Hot Rod client. UnsupportedOperationException is thrown if his method is invoked.

template<class K, class V>
std::set<std::pair<K, V> > infinispan::hotrod::RemoteCache< K, V >::entrySet ( )
inline

Unsupported operation in this release of Hot Rod client. UnsupportedOperationException is thrown if his method is invoked.

template<class K, class V>
std::vector<unsigned char> infinispan::hotrod::RemoteCache< K, V >::execute ( const std::string &  name,
const std::map< std::string, std::string > &  args 
)
inline

Execute script on server

Parameters
namename of the script
argsmaps of (name,value) arguments
Returns
byte[] result in dark matter shape
template<class K, class V>
std::vector<unsigned char> infinispan::hotrod::RemoteCache< K, V >::execute ( const std::string &  name,
const std::map< std::vector< char >, std::vector< char > > &  args 
)
inline

Execute script on server

Parameters
namename of the script
argsmaps of (name,value) arguments
Returns
byte[] result in dark matter shape
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::get ( const K &  key)
inline

Returns the value to which the specified key is mapped, or NULL if this cache contains no mapping for the key.

Parameters
keythe key whose associated value is to be returned
Returns
the value to which the specified key is mapped, or NULL if this map contains no mapping for the key
template<class K, class V>
std::map<std::shared_ptr<K>, std::shared_ptr<V> > infinispan::hotrod::RemoteCache< K, V >::getAll ( const std::set< K > &  keySet)
inline

Returns a map of key,value pairs according to the set of keys passed in input

Parameters
keySetthe set of the keys whose associated values are to be returned
Returns
a map containing the key, value pairs
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::getAsync ( const K &  key,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of get. Executes function f when get() returns

See the synchronous doc for parameters not explained here

Parameters
keythe key whose associated value is to be returned
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future that will contain a pointer to the requested value or null
template<class K, class V>
std::map<std::shared_ptr<K>, std::shared_ptr<V> > infinispan::hotrod::RemoteCache< K, V >::getBulk ( )
inline

Unsupported operation in this release of Hot Rod client. UnsupportedOperationException is thrown if his method is invoked.

template<class K, class V>
std::map<std::shared_ptr<K>, std::shared_ptr<V> > infinispan::hotrod::RemoteCache< K, V >::getBulk ( int  nrOfEntries)
inline

Returns nrOfEntries from a remote cache in map. TODO

template<class K, class V>
CacheTopologyInfo infinispan::hotrod::RemoteCache< K, V >::getCacheTopologyInfo ( )
inline
template<class K, class V>
std::string infinispan::hotrod::RemoteCache< K, V >::getName ( )
inline

Retrieves the name of the cache

Returns
the name of the cache
template<class K, class V>
std::string infinispan::hotrod::RemoteCache< K, V >::getProtocolVersion ( )
inline

Retrieves the protocol version

Returns
protocol version as string
template<class K, class V>
template<class M = JBossMarshaller>
RemoteExecution<M> infinispan::hotrod::RemoteCache< K, V >::getRemoteExecution ( )
inline

Get a remote execution context

Returns
a RemoteExecution object that simplify the call of a remote execution task
template<class K, class V>
std::string infinispan::hotrod::RemoteCache< K, V >::getVersion ( )
inline

Retrieves the version of Infinispan

Returns
a version string
template<class K, class V>
std::pair<std::shared_ptr<V>, MetadataValue> infinispan::hotrod::RemoteCache< K, V >::getWithMetadata ( const K &  key)
inline

Returns the std::pair with value and MetadataValue associated to the supplied key parameter or a default initialized std::pair if it doesn't exist

Parameters
keythe key
Returns
std::pair where first entry is a pointer to a value and second pair entry is an accompanying MetadataValue
template<class K, class V>
std::pair<std::shared_ptr<V>, VersionedValue> infinispan::hotrod::RemoteCache< K, V >::getWithVersion ( const K &  key)
inline

Returns the std::pair with value and VersionedValue associated with the supplied key parameter or a default initialized std::pair if it doesn't exist

Parameters
keythe key
Returns
std::pair where first entry is a pointer to a value and second pair entry is an accompanying VersionedValue
template<class K, class V>
bool infinispan::hotrod::RemoteCache< K, V >::isEmpty ( )
inline

Returns true if and only if this cache has no entries.

Returns
true if cache is empty
template<class K, class V>
std::set<std::shared_ptr<K> > infinispan::hotrod::RemoteCache< K, V >::keySet ( )
inline

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.

Returns
a std::set of pointers to all keys in this given cache
template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::ping ( )
inline

Pings remote cache on a Hot Rod server

template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::put ( const K &  key,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0 
)
inline

Associates the specified value with the specified key in this cache.

If the cache previously contained a mapping for the key, the old value is replaced by the specified value.

If the return value of this operation will be ignored by the application, the user is strongly encouraged to use the IGNORE_RETURN_VALUES Flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
Returns
the previous value associated with key, or NULL if there was no mapping for key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::put ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit 
)
inline

Associates the specified value with the specified key in this cache.

If the cache previously contained a mapping for the key, the old value is replaced by the specified value.

If the return value of this operation will be ignored by the application, the user is strongly encouraged to use the IGNORE_RETURN_VALUES Flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
Returns
the previous value associated with key, or NULL if there was no mapping for key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::put ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit 
)
inline

Associates the specified value with the specified key in this cache.

If the cache previously contained a mapping for the key, the old value is replaced by the specified value.

If the return value of this operation will be ignored by the application, the user is strongly encouraged to use the IGNORE_RETURN_VALUES Flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
maxIdleUnitTimeUnit for the maxIdle param
Returns
the previous value associated with key, or NULL if there was no mapping for key.
template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::putAll ( const std::map< K, V > &  map,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0 
)
inline

Copies all of the mappings from the specified map to this cache. The effect of this call is equivalent to that of calling put(k, v) on this cache once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

Parameters
mapto be stored in this cache
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
maxIdlethe maximum amount of time these object are allowed to be idle before they are considered as expired
template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::putAll ( const std::map< K, V > &  map,
uint64_t  lifespan,
TimeUnit  lifespanUnit 
)
inline

Copies all of the mappings from the specified map to this cache. The effect of this call is equivalent to that of calling put(k, v) on this cache once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

Parameters
mapto be stored in this cache
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::putAll ( const std::map< K, V > &  map,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit 
)
inline

Copies all of the mappings from the specified map to this cache. The effect of this call is equivalent to that of calling put(k, v) on this cache once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

Parameters
mapto be stored in this cache
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time these object are allowed to be idle before they are considered as expired
maxIdleUnitTimeUnit for the maxIdle param
template<class K, class V>
std::future<void> infinispan::hotrod::RemoteCache< K, V >::putAllAsync ( const std::map< K, V > &  map,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0,
std::function< void()>  success = nullptr,
std::function< void(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of putAll() See the synchronous doc for parameters not explained here

Parameters
mapto be stored in this cache
lifespanthe lifespan of these entries. A negative value is interpreted as unlimited lifespan
maxIdlethe maximum amount of time these objects are allowed to be idle before they are considered as expired
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<void> infinispan::hotrod::RemoteCache< K, V >::putAllAsync ( const std::map< K, V > &  map,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
std::function< void(void)>  success = nullptr,
std::function< void(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of putAll() See the synchronous doc for parameters not explained here

Parameters
mapto be stored in this cache
lifespanthe lifespan of these entries. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<void> infinispan::hotrod::RemoteCache< K, V >::putAllAsync ( const std::map< K, V > &  map,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit,
std::function< void(void)>  success = nullptr,
std::function< void(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of putAll() See the synchronous doc for parameters not explained here

Parameters
mapto be stored in this cache
lifespanthe lifespan of these entries. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time these are allowed to be idle before they are considered as expired
maxIdleUnitTimeUnit for the maxIdle param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::putAsync ( const K &  key,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of put()

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::putAsync ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of put()

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::putAsync ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of put()

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
maxIdleUnitTimeUnit for the maxIdle param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::putIfAbsent ( const K &  key,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0 
)
inline

Associates the specified value with the specified key in this cache if the specified key is not already associated with some value. In such case key is associated with the given value.

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::putIfAbsent ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit 
)
inline

Associates the specified value with the specified key in this cache if the specified key is not already associated with some value. In such case key is associated with the given value.

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::putIfAbsent ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit 
)
inline

Associates the specified value with the specified key in this cache if the specified key is not already associated with some value. In such case key is associated with the given value.

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
maxIdleUnitTimeUnit for the maxIdle param
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::putIfAbsentAsync ( const K &  key,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of putIfAbsentAsync()

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::putIfAbsentAsync ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of putIfAbsentAsync()

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::putIfAbsentAsync ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of putIfAbsentAsync()

Parameters
keykey with which the specified value is to be associated
valvalue value to be associated with the specified key
lifespanthe lifespan of this entry. A negative value is interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
maxIdleUnitTimeUnit for the maxIdle param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
QueryResponse infinispan::hotrod::RemoteCache< K, V >::query ( const QueryRequest qr)
inline

Execute a query on server

Parameters
qrthe QueryRequest oject
Returns
a QueryResponse object with the query result
template<class K, class V>
std::vector<unsigned char> infinispan::hotrod::RemoteCache< K, V >::query ( std::vector< unsigned char >  qr,
size_t  size 
)
inline

Execute a query on server

Parameters
qrthe query string
sizethe length of the query string
Returns
byte[] result in dark matter shape
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::remove ( const K &  key)
inline

Removes key/value pair from the cache given a key. Optionally return a value stored under the given key

Parameters
keythe of the entry to be removed
Returns
NULL or value stored under this key
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::removeAsync ( const K &  key,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of removeWithVersion() See the synchronous doc for parameters not explained here

Parameters
keythe of the entry to be removed
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a bool. True if the entry has been removed
template<class K, class V>
void infinispan::hotrod::RemoteCache< K, V >::removeClientListener ( ClientListener clientListener)
inline

Stop and remove client listener

Parameters
clientListenerthe listener to be removed
Returns
template<class K, class V>
template<typename... Params>
void infinispan::hotrod::RemoteCache< K, V >::removeContinuousQueryListener ( ContinuousQueryListener< Params...> &  cql)
inline

Start a client listener on the specified query and register it on the server

Parameters
cqlobject defining the query to be observed
template<class K, class V>
bool infinispan::hotrod::RemoteCache< K, V >::removeWithVersion ( const K &  key,
uint64_t  version 
)
inline

Removes the given entry only if its version matches the supplied version.

A typical use case looks like this:

std::pair<std::shared_ptr<std::string>, VersionedValue> rv = remoteCache.getWithVersioned(key);
//some processing...
remoteCache.removeWithVersion(key, rv.second().version);

Last call (removeWithVersion) will make sure that the entry will only be removed if it hasn't been changed in the meantime.

Parameters
keykey
versionversion of entry to remove
Returns
true if the entry has been removed
See Also
VersionedValue
template<class K, class V>
std::future<bool> infinispan::hotrod::RemoteCache< K, V >::removeWithVersionAsync ( const K &  key,
uint64_t  version,
std::function< bool(bool)>  success = nullptr,
std::function< bool(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of removeWithVersion()

Parameters
keykey
versionversion of entry to remove
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a bool. True if the entry has been removed
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::replace ( const K &  key,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0 
)
inline

Replaces the entry for a key with a given new value.

Parameters
keykey with which the specified value is to be associated
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::replace ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit 
)
inline

Replaces the entry for a key with a given new value.

Parameters
keykey with which the specified value is to be associated
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::replace ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit 
)
inline

Replaces the entry for a key with a given new value.

Parameters
keykey with which the specified value is to be associated
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
maxIdleUnitTimeUnit for the maxIdle param
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::replace ( const K &  key,
const V &  oldVal,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0 
)
inline

Replaces the entry for a key with a new value only if currently mapped to a given old value.

Parameters
keykey with which the specified value is to be associated
oldValvalue expected to be associated with the specified key
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::replace ( const K &  key,
const V &  oldVal,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit 
)
inline

Replaces the entry for a key with a new value only if currently mapped to a given old value.

Parameters
keykey with which the specified value is to be associated
oldValvalue expected to be associated with the specified key
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
V* infinispan::hotrod::RemoteCache< K, V >::replace ( const K &  key,
const V &  oldVal,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit 
)
inline

Replaces the entry for a key with a new value only if currently mapped to a given old value.

Parameters
keykey with which the specified value is to be associated
oldValvalue expected to be associated with the specified key
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
maxIdleUnitTimeUnit for the maxIdle param
Returns
the previous value associated with the specified key, or NULL if there was no mapping for the key.
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::replaceAsync ( const K &  key,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of replace()

Parameters
keykey with which the specified value is to be associated
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::replaceAsync ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of replace()

Parameters
keykey with which the specified value is to be associated
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::replaceAsync ( const K &  key,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
uint64_t  maxIdle,
TimeUnit  maxIdleUnit,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of replace()

Parameters
keykey with which the specified value is to be associated
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
maxIdleUnitTimeUnit for the maxIdle param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::replaceAsync ( const K &  key,
const V &  oldVal,
const V &  val,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of replace() See the synchronous doc for parameters not explained here

Parameters
keykey with which the specified value is to be associated
oldValvalue expected to be associated with the specified key
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
std::future<V*> infinispan::hotrod::RemoteCache< K, V >::replaceAsync ( const K &  key,
const V &  oldVal,
const V &  val,
uint64_t  lifespan,
TimeUnit  lifespanUnit,
std::function< V *(V *)>  success = nullptr,
std::function< V *(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of replace() See the synchronous doc for parameters not explained here

Parameters
keykey with which the specified value is to be associated
oldValvalue expected to be associated with the specified key
valvalue to be associated with the specified key
lifespanlifespan of the entry. Negative values are interpreted as unlimited lifespan
lifespanUnitTimeUnit for the lifespan param
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
bool infinispan::hotrod::RemoteCache< K, V >::replaceWithVersion ( const K &  key,
const V &  val,
uint64_t  version,
uint64_t  lifespan = 0,
uint64_t  maxIdle = 0 
)
inline

Replaces the given value only if its version matches the supplied version.

Parameters
keythe key
valthe new value for the given key
versionnumeric version that should match the one in the server for the operation to succeed
lifespanthe new lifespan for this key/value entry pair
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
Returns
true if the value has been replaced
See Also
VersionedValue
template<class K, class V>
std::future<bool> infinispan::hotrod::RemoteCache< K, V >::replaceWithVersionAsync ( const K &  key,
const V &  val,
uint64_t  version,
uint64_t  lifespan,
uint64_t  maxIdle,
std::function< bool(bool)>  success = nullptr,
std::function< bool(std::exception &)>  fail = nullptr 
)
inline

Asynchronous version of replaceWithVersion()

Parameters
keythe key
valthe new value for the given key
versionnumeric version that should match the one in the server for the operation to succeed
lifespanthe new lifespan for this key/value entry pair
maxIdlethe maximum amount of time this entry is allowed to be idle before it is considered as expired
successfunction to be executed on success
failfunction to be executed if exceptions occur
Returns
a future containing a pointer to the previous value stored in the cache for the given key or null
template<class K, class V>
uint64_t infinispan::hotrod::RemoteCache< K, V >::size ( )
inline

Returns an approximate number of key/value pairs in this cache.

Returns
number of entries in cache
template<class K, class V>
std::map<std::string, std::string> infinispan::hotrod::RemoteCache< K, V >::stats ( )
inline

Returns statistics for this cache.

Returns
a std::map of string key/value pairs where each key is a certain statistic property while the matching value represents the value for that property
template<class K, class V>
std::vector<V> infinispan::hotrod::RemoteCache< K, V >::values ( )
inline

Unsupported operation in this release of Hot Rod client. UnsupportedOperationException is thrown if his method is invoked.

template<class K, class V>
RemoteCache infinispan::hotrod::RemoteCache< K, V >::withDataFormat ( DataFormat< K, V > *  df)
inline

Create a new RemoteCache instance with the specified DataFormat

Parameters
dfthe DataFormat struct specifying entry media type and marshaller
Returns
the new RemoteCache that can handle the specified DataFormat
template<class K, class V>
template<class K1 , class V1 >
RemoteCache<K1,V1> infinispan::hotrod::RemoteCache< K, V >::withDataFormat ( DataFormat< K1, V1 > *  df)
inline

Create a new RemoteCache instance with the specified DataFormat

Use this method if the new cache must deal with different key,value types than those defined for this cache

Parameters
dfthe DataFormat struct specifying entry media type and marshaller
Returns
the new RemoteCache that can handle the specified DataFormat
template<class K, class V>
RemoteCache<K, V>& infinispan::hotrod::RemoteCache< K, V >::withFlags ( Flag  flags)
inline

Applies one or more Flag enums to the scope of a single invocation.

Parameters
flagsthe flags to apply to an invocation
Returns
the current RemoteCache instance

Friends And Related Function Documentation

template<class K, class V>
template<class K1 , class V1 >
friend class RemoteCache
friend
template<class K, class V>
friend class RemoteCacheManager
friend

The documentation for this class was generated from the following files: