1 #ifndef ISPN_HOTROD_REMOTECACHE_H 2 #define ISPN_HOTROD_REMOTECACHE_H 64 template<
class K,
class V>
class RemoteCache:
private RemoteCacheBase
67 #ifndef SWIG // Let SWIG ignore this method 68 template<
typename Function>
69 inline std::future<typename std::result_of<Function()>::type> goAsync(Function&& f,
70 std::function<
typename std::result_of<Function()>::type(
typename std::result_of<Function()>::type)> success,
71 std::function<
typename std::result_of<Function()>::type(std::exception&)> fail)
75 {
return success==0 ? f() : success(f());}
76 catch (std::exception& ex)
82 return std::async(fq);
85 template<
typename Function>
86 inline std::future<void> goAsync(Function&& f, std::function<
void()> success,
87 std::function<
void(std::exception&)> fail)
91 {
if (success==0) f();
93 catch (std::exception& ex)
99 return std::async(fq);
113 return std::string(base_getName());
145 return (V *) base_get(&key);
149 V* get_async(
const K& key)
151 return (V *) base_get(&key);
163 std::map<std::shared_ptr<K>, std::shared_ptr<V> >
getAll(
const std::set<K>&
keySet)
165 std::set<std::vector<char> > keySetMarshalled;
166 for (
auto item =
keySet.begin(); item !=
keySet.end(); item++)
169 this->keyMarshaller->marshall(*item, v);
170 keySetMarshalled.insert(v);
172 auto marshalledResult = base_getAll(keySetMarshalled);
173 std::map<std::shared_ptr<K>, std::shared_ptr<V> > result;
174 for (
auto item : marshalledResult)
176 std::shared_ptr<K> rk(this->keyMarshaller->unmarshall(item.first));
177 std::shared_ptr<V> rv(this->keyMarshaller->unmarshall(item.second));
193 std::future<V*>
getAsync(
const K& key, std::function<V* (V*)> success =
nullptr,
194 std::function<V* (std::exception&)> fail =
nullptr)
196 const K* pKey = &key;
197 auto currTx = transactionManager.getCurrentTransaction();
198 std::function<V* (void)> f = [=]
199 {
return (V*)this->base_get(pKey, currTx);};
200 return goAsync(f, success, fail);
222 V*
put(
const K& key,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle = 0)
245 V*
put(
const K& key,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit)
247 return put(key, val, lifespan, lifespanUnit, 0,
SECONDS);
271 V*
put(
const K& key,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit, uint64_t maxIdle,
TimeUnit maxIdleUnit)
273 return (V *) base_put(&key, &val, toSeconds(lifespan, lifespanUnit), toSeconds(maxIdle, maxIdleUnit));
287 std::future<V*>
putAsync(
const K& key,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle = 0,
288 std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
290 const K* pKey = &key;
291 const V* pVal = &val;
292 auto currTx = transactionManager.getCurrentTransaction();
293 std::function<V* (void)> f = [=]
294 {
return (V*)this->base_put(pKey, pVal, lifespan, maxIdle, currTx);};
295 return goAsync(f, success, fail);
309 std::future<V*>
putAsync(
const K& key,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit,
310 std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
312 const K* pKey = &key;
313 const V* pVal = &val;
314 auto currTx = transactionManager.getCurrentTransaction();
315 std::function<V* (void)> f = [=]
316 {
return (V*)this->base_put(pKey, pVal, lifespan, lifespanUnit, currTx);};
317 return goAsync(f, success, fail);
333 std::future<V*>
putAsync(
const K& key,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit, uint64_t maxIdle,
334 TimeUnit maxIdleUnit, std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
337 const K* pKey = &key;
338 const V* pVal = &val;
339 auto currTx = transactionManager.getCurrentTransaction();
340 std::function<V* (void)> f = [=]
341 {
return (V*)this->base_put(pKey, pVal, toSeconds(lifespan, lifespanUnit), toSeconds(maxIdle, maxIdleUnit), currTx); };
342 return goAsync(f, success, fail);
355 V*
putIfAbsent(
const K& key,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle = 0)
388 return (V *) base_putIfAbsent(&key, &val, toSeconds(lifespan, lifespanUnit), toSeconds(maxIdle, maxIdleUnit));
401 std::future<V*>
putIfAbsentAsync(
const K& key,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle = 0,
402 std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
404 const K* pKey = &key;
405 const V* pVal = &val;
406 auto currTx = transactionManager.getCurrentTransaction();
407 std::function<V* (void)> f = [=]
408 {
return (V*)this->base_putIfAbsent(pKey,pVal, lifespan, maxIdle, currTx);};
409 return goAsync(f, success, fail);
423 std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
425 const K* pKey = &key;
426 const V* pVal = &val;
427 auto currTx = transactionManager.getCurrentTransaction();
428 std::function<V* (void)> f = [=]
429 {
return (V*)this->base_putIfAbsent(pKey, pVal, toSeconds(lifespan, lifespanUnit), toSeconds(0,
SECONDS), currTx); };
430 return goAsync(f, success, fail);
446 uint64_t maxIdle,
TimeUnit maxIdleUnit, std::function<V* (V*)> success =
nullptr,
447 std::function<V* (std::exception&)> fail =
nullptr)
449 const K* pKey = &key;
450 const V* pVal = &val;
451 auto currTx = transactionManager.getCurrentTransaction();
452 std::function<V* (void)> f = [=]
453 {
return (V*)this->base_putIfAbsent(pKey,pVal, toSeconds(lifespan, lifespanUnit), toSeconds(maxIdle, maxIdleUnit), currTx);};
454 return goAsync(f, success, fail);
466 void putAll(
const std::map<K, V>& map, uint64_t lifespan = 0, uint64_t maxIdle = 0)
498 void putAll(
const std::map<K, V>& map, uint64_t lifespan,
TimeUnit lifespanUnit, uint64_t maxIdle,
501 uint64_t lifespanMillis = toSeconds(lifespan, lifespanUnit);
502 uint64_t maxIdleMillis = toSeconds(maxIdle, maxIdleUnit);
503 std::map<const void*, const void*> tmpMap;
506 tmpMap[(
const void *)&it.first] = (
const void *)&it.second;
508 base_putAll(tmpMap, lifespanMillis, maxIdleMillis);
522 std::future<void>
putAllAsync(
const std::map<K, V>& map, uint64_t lifespan = 0, uint64_t maxIdle = 0,
523 std::function<
void()> success =
nullptr, std::function<
void(std::exception&)> fail =
nullptr)
527 {
return this->
putAll(pMap, lifespan, maxIdle);};
528 return goAsync(f, success, fail);
543 std::function<
void(
void)> success =
nullptr, std::function<
void(std::exception&)> fail =
nullptr)
547 { this->
putAll(pMap, lifespan, lifespanUnit);};
548 return goAsync(f, success, fail);
564 std::future<void>
putAllAsync(
const std::map<K, V>& map, uint64_t lifespan,
TimeUnit lifespanUnit, uint64_t maxIdle,
565 TimeUnit maxIdleUnit, std::function<
void(
void)> success =
nullptr,
566 std::function<
void(std::exception&)> fail =
nullptr)
570 { this->
putAll(*pMap,lifespan, lifespanUnit, maxIdle, maxIdleUnit);};
571 return goAsync(f, success, fail);
584 V*
replace(
const K& key,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle = 0)
615 V*
replace(
const K& key,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit, uint64_t maxIdle,
618 return (V *) base_replace(&key, &val, toSeconds(lifespan, lifespanUnit), toSeconds(maxIdle, maxIdleUnit));
631 V*
replace(
const K& key,
const V& oldVal,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle = 0)
646 V*
replace(
const K& key,
const V& oldVal,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit)
648 return replace(key, oldVal, val, lifespan, lifespanUnit, 0,
SECONDS);
662 V*
replace(
const K& key,
const V& oldVal,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit, uint64_t maxIdle,
679 std::future<V*>
replaceAsync(
const K& key,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle = 0,
680 std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
682 auto pKey = &key, pVal = &val;
685 return goAsync(f, success, fail);
700 std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
702 auto pKey = &key, pVal = &val;
704 {
return this->
replace(*pKey, *pVal, lifespan, lifespanUnit, 0,
SECONDS);};
705 return goAsync(f, success, fail);
721 std::future<V*>
replaceAsync(
const K& key,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit, uint64_t maxIdle,
722 TimeUnit maxIdleUnit, std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
725 auto pKey = &key, pVal = &val;
727 {
return this->
replace(*pKey, *pVal, lifespan, lifespanUnit, maxIdle, maxIdleUnit);};
728 return goAsync(f, success, fail);
744 std::future<V*>
replaceAsync(
const K& key,
const V& oldVal,
const V& val, uint64_t lifespan = 0, uint64_t maxIdle =
745 0, std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
749 return goAsync(f, success, fail);
765 std::future<V*>
replaceAsync(
const K& key,
const V& oldVal,
const V& val, uint64_t lifespan,
TimeUnit lifespanUnit,
766 std::function<V* (V*)> success =
nullptr, std::function<V* (std::exception&)> fail =
nullptr)
769 {
return this->
replace(key, oldVal, val, lifespan, lifespanUnit, 0,
SECONDS);};
770 return goAsync(f, success, fail);
780 V*
remove(
const K& key)
782 return (V *) base_remove(&key);
794 std::future<V*>
removeAsync(
const K& key, std::function<V* (V*)> success =
nullptr,
795 std::function<V* (std::exception&)> fail =
nullptr)
798 {
return this->
remove(key);};
799 return goAsync(f, success, fail);
810 return base_containsKey(&key);
835 bool replaceWithVersion(
const K& key,
const V& val, uint64_t version, uint64_t lifespan = 0, uint64_t maxIdle = 0)
837 return base_replaceWithVersion(&key, &val, version, lifespan, maxIdle);
854 uint64_t maxIdle, std::function<
bool(
bool)> success =
nullptr, std::function<
bool(std::exception&)> fail =
859 return goAsync(f, success, fail);
882 return base_removeWithVersion(&key, version);
895 std::function<
bool(
bool)> success =
nullptr, std::function<
bool(std::exception&)> fail =
nullptr)
899 return goAsync(f, success, fail);
915 void *value = base_getWithVersion(&key, &version);
916 return std::make_pair(std::shared_ptr<V>((V *) value), version);
931 void *value = base_getWithMetadata(&key, &metadata);
932 return std::make_pair(std::shared_ptr<V>((V *) value), metadata);
938 std::map<std::shared_ptr<K>, std::shared_ptr<V> >
getBulk()
946 std::map<std::shared_ptr<K>, std::shared_ptr<V> >
getBulk(
int nrOfEntries)
948 std::map<void*, void*> mbuf;
949 std::map<std::shared_ptr<K>, std::shared_ptr<V> > result;
950 base_getBulk(nrOfEntries, mbuf);
951 for (
auto it = mbuf.begin(); it != mbuf.end(); ++it)
953 result[std::shared_ptr<K>((K*) it->first)] = std::shared_ptr<V>((V*) it->second);
963 std::vector<unsigned char>
execute(
const std::string& name,
const std::map<std::string, std::string>& args)
965 return base_execute(name, args);
974 std::vector<unsigned char>
execute(
const std::string& name,
const std::map<std::vector<char>, std::vector<char> >& args)
976 return base_execute(name,args);
986 return base_query(qr);
995 std::vector<unsigned char>
query(std::vector<unsigned char> qr,
size_t size)
997 return base_query_char(qr,
size);
1017 std::vector<void*> p;
1020 std::set<std::shared_ptr<K> > result;
1021 for (
size_t i = 0; i < p.size(); ++i)
1023 result.insert(std::shared_ptr<K>((K*) p.data()[i]));
1059 std::map<std::string, std::string>
stats()
1061 std::map<std::string, std::string> statistics;
1062 base_stats(statistics);
1083 std::future<void>
clearAsync(std::function<
void(
void)> success =
nullptr,
1084 std::function<
void(std::exception&)> fail =
nullptr)
1088 return goAsync(f, success, fail);
1112 std::vector<std::vector<char> > converterFactoryParams,
const std::function<
void()> &recoveryCallback =
1115 base_addClientListener(clientListener, filterFactoryParams, converterFactoryParams, recoveryCallback);
1127 base_removeClientListener(clientListener);
1130 #if !defined(SWIG) && !defined(SWIGCSHARP) 1138 base_addContinuousQueryListener(cql);
1140 template<
typename ... Params>
1148 base_addContinuousQueryListener(cql);
1156 template<
typename ... Params>
1159 base_removeClientListener(cql.cl);
1165 return base_getCacheTopologyInfo();
1175 base_withFlags(flags);
1185 template <
class M = JBossMarshaller>
1192 RemoteCacheBase(other), keyMarshaller(other.keyMarshaller), valueMarshaller(other.valueMarshaller)
1194 setMarshallers(
this, &keyMarshall, &valueMarshall, &keyUnmarshall, &valueUnmarshall);
1195 valueCopyConstructor = [](
const void* src) { V* v =
new V(*static_cast<const V*>(src));
return (
void*) v; };
1196 valueDestructor = [](
const void* obj) {
delete static_cast<const V*
>(obj); };
1208 rc.keyMarshaller = (df->keyMarshaller !=
nullptr) ? df->keyMarshaller : this->keyMarshaller;
1209 rc.valueMarshaller = (df->valueMarshaller !=
nullptr) ? df->valueMarshaller : this->valueMarshaller;
1210 rc.cloneImplWithDataFormat(df);
1225 rc.keyMarshaller = df->keyMarshaller;
1226 rc.valueMarshaller = df->valueMarshaller;
1227 rc.cloneImplWithDataFormat(df);
1234 setRemoteCachePtr(
this);
1238 RemoteCacheBase(tm, tt, forceReturnValue, transactional)
1240 valueCopyConstructor = [](
const void* src) { V* v =
new V(*static_cast<const V*>(src));
return (
void*) v; };
1241 valueDestructor = [](
const void* obj) {
delete static_cast<const V*
>(obj); };
1242 setMarshallers(
this, &keyMarshall, &valueMarshall, &keyUnmarshall, &valueUnmarshall);
1246 uint64_t toSeconds(uint64_t time,
TimeUnit unit)
1252 result = (uint64_t) ceil(time / 1000000000.0);
1255 result = (uint64_t) ceil(time / 1000000.0);
1258 result = (uint64_t) ceil(time / 1000.0);
1267 result = time * 3600;
1270 result = time * 86400;
1273 std::stringstream ss;
1274 ss <<
"Unhandled TimeUnit specified: " << unit <<
".";
1275 throw std::invalid_argument(ss.str());
1281 static void keyMarshall(
void *thisp,
const void* key, std::vector<char> &buf)
1285 static void valueMarshall(
void* thisp,
const void* val, std::vector<char> &buf)
1287 ((
RemoteCache<K, V> *) thisp)->valueMarshaller->marshall(*(
const V *) val, buf);
1289 static void* keyUnmarshall(
void *thisp,
const std::vector<char> &buf)
1293 static void* valueUnmarshall(
void* thisp,
const std::vector<char> &buf)
1298 std::shared_ptr<Marshaller<K> > keyMarshaller;
1299 std::shared_ptr<Marshaller<V> > valueMarshaller;
void putAll(const std::map< K, V > &map, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
Definition: RemoteCache.h:498
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)
Definition: RemoteCache.h:309
std::map< std::shared_ptr< K >, std::shared_ptr< V > > getBulk(int nrOfEntries)
Definition: RemoteCache.h:946
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)
Definition: RemoteCache.h:853
V * putIfAbsent(const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
Definition: RemoteCache.h:369
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)
Definition: RemoteCache.h:522
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)
Definition: RemoteCache.h:401
std::vector< unsigned char > query(std::vector< unsigned char > qr, size_t size)
Definition: RemoteCache.h:995
V * put(const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
Definition: RemoteCache.h:271
std::string getName()
Definition: RemoteCache.h:111
Definition: Transactions.h:174
std::pair< std::shared_ptr< V >, VersionedValue > getWithVersion(const K &key)
Definition: RemoteCache.h:912
std::set< std::pair< K, V > > entrySet()
Definition: RemoteCache.h:1004
static const char * getProtocolVersionCString()
Definition: Version.h:32
std::map< std::shared_ptr< K >, std::shared_ptr< V > > getAll(const std::set< K > &keySet)
Definition: RemoteCache.h:163
bool containsKey(const K &key)
Definition: RemoteCache.h:808
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)
Definition: RemoteCache.h:721
std::map< std::string, std::string > stats()
Definition: RemoteCache.h:1059
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)
Definition: RemoteCache.h:445
V * replace(const K &key, const V &oldVal, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
Definition: RemoteCache.h:631
std::set< std::shared_ptr< K > > keySet()
Definition: RemoteCache.h:1015
void putAll(const std::map< K, V > &map, uint64_t lifespan=0, uint64_t maxIdle=0)
Definition: RemoteCache.h:466
RemoteExecution< M > getRemoteExecution()
Definition: RemoteCache.h:1186
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)
Definition: RemoteCache.h:542
std::vector< V > values()
Definition: RemoteCache.h:1049
void addContinuousQueryListener(ContinuousQueryListener< K, V > &cql)
Definition: RemoteCache.h:1136
V * putIfAbsent(const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
Definition: RemoteCache.h:385
std::map< std::shared_ptr< K >, std::shared_ptr< V > > getBulk()
Definition: RemoteCache.h:938
RemoteCache withDataFormat(DataFormat< K, V > *df)
Definition: RemoteCache.h:1206
std::future< bool > removeWithVersionAsync(const K &key, uint64_t version, std::function< bool(bool)> success=nullptr, std::function< bool(std::exception &)> fail=nullptr)
Definition: RemoteCache.h:894
Definition: TransactionManager.h:24
Definition: CacheClientListener.h:28
Definition: TimeUnit.h:14
Definition: TimeUnit.h:18
V * putIfAbsent(const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
Definition: RemoteCache.h:355
Definition: TimeUnit.h:15
RemoteCache(TransactionManager &tm, TransactionTable &tt, bool forceReturnValue, bool transactional)
Definition: RemoteCache.h:1237
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)
Definition: RemoteCache.h:287
Definition: AuthenticationConfiguration.h:10
V * replace(const K &key, const V &oldVal, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
Definition: RemoteCache.h:646
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)
Definition: RemoteCache.h:422
uint64_t size()
Definition: RemoteCache.h:1032
std::future< V * > getAsync(const K &key, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
Definition: RemoteCache.h:193
void removeClientListener(ClientListener &clientListener)
Definition: RemoteCache.h:1125
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)
Definition: RemoteCache.h:744
void addClientListener(ClientListener &clientListener, std::vector< std::vector< char > > filterFactoryParams, std::vector< std::vector< char > > converterFactoryParams, const std::function< void()> &recoveryCallback=nullptr)
Definition: RemoteCache.h:1111
std::vector< unsigned char > execute(const std::string &name, const std::map< std::string, std::string > &args)
Definition: RemoteCache.h:963
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)
Definition: RemoteCache.h:765
CacheTopologyInfo getCacheTopologyInfo()
Definition: RemoteCache.h:1163
void clear()
Definition: RemoteCache.h:1070
bool isEmpty()
Definition: RemoteCache.h:1041
std::future< void > clearAsync(std::function< void(void)> success=nullptr, std::function< void(std::exception &)> fail=nullptr)
Definition: RemoteCache.h:1083
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)
Definition: RemoteCache.h:679
V * put(const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
Definition: RemoteCache.h:245
RemoteCache< K, V > & withFlags(Flag flags)
Definition: RemoteCache.h:1173
RemoteCache(const RemoteCache &other)
Definition: RemoteCache.h:1191
bool replaceWithVersion(const K &key, const V &val, uint64_t version, uint64_t lifespan=0, uint64_t maxIdle=0)
Definition: RemoteCache.h:835
std::string getVersion()
Definition: RemoteCache.h:121
Definition: RemoteCacheManager.h:43
Definition: TimeUnit.h:17
std::string getProtocolVersion()
Definition: RemoteCache.h:131
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)
Definition: RemoteCache.h:564
std::future< V * > removeAsync(const K &key, std::function< V *(V *)> success=nullptr, std::function< V *(std::exception &)> fail=nullptr)
Definition: RemoteCache.h:794
V * replace(const K &key, const V &oldVal, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
Definition: RemoteCache.h:662
Definition: ClientListener.h:35
RemoteCache< K1, V1 > withDataFormat(DataFormat< K1, V1 > *df)
Definition: RemoteCache.h:1223
void removeContinuousQueryListener(ContinuousQueryListener< Params... > &cql)
Definition: RemoteCache.h:1157
V * replace(const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit, uint64_t maxIdle, TimeUnit maxIdleUnit)
Definition: RemoteCache.h:615
void ping()
Definition: RemoteCache.h:1096
Definition: exceptions.h:112
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)
Definition: RemoteCache.h:333
RemoteCache(const RemoteCacheBase &rcb)
Definition: RemoteCache.h:1233
QueryResponse query(const QueryRequest &qr)
Definition: RemoteCache.h:984
Definition: ContinuousQueryListener.h:34
static const char * getVersionCString()
Definition: Version.h:41
TimeUnit
Definition: TimeUnit.h:13
bool containsValue(const V &val)
Definition: RemoteCache.h:817
V * replace(const K &key, const V &val, uint64_t lifespan, TimeUnit lifespanUnit)
Definition: RemoteCache.h:599
Definition: TimeUnit.h:16
Definition: TimeUnit.h:19
Definition: TimeUnit.h:20
V * replace(const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
Definition: RemoteCache.h:584
std::vector< unsigned char > execute(const std::string &name, const std::map< std::vector< char >, std::vector< char > > &args)
Definition: RemoteCache.h:974
std::pair< std::shared_ptr< V >, MetadataValue > getWithMetadata(const K &key)
Definition: RemoteCache.h:928
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)
Definition: RemoteCache.h:699
Definition: RemoteExecution.h:29
Definition: VersionedValue.h:9
V * put(const K &key, const V &val, uint64_t lifespan=0, uint64_t maxIdle=0)
Definition: RemoteCache.h:222
void addContinuousQueryListener(ContinuousQueryListener< K, V, Params... > &cql)
Definition: RemoteCache.h:1146
void putAll(const std::map< K, V > &map, uint64_t lifespan, TimeUnit lifespanUnit)
Definition: RemoteCache.h:481
bool removeWithVersion(const K &key, uint64_t version)
Definition: RemoteCache.h:880