16 #ifndef HAZELCAST_CLIENT_INTERNAL_NEARCACHE_NEARCACHEMANAGER_H_ 17 #define HAZELCAST_CLIENT_INTERNAL_NEARCACHE_NEARCACHEMANAGER_H_ 22 #include "hazelcast/util/HazelcastDll.h" 23 #include "hazelcast/client/internal/nearcache/NearCache.h" 24 #include "hazelcast/client/internal/nearcache/impl/DefaultNearCache.h" 25 #include "hazelcast/client/serialization/pimpl/SerializationService.h" 27 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 29 #pragma warning(disable: 4251) //for dll export 41 NearCacheManager(serialization::pimpl::SerializationService &ss, util::ILogger &logger);
52 template<
typename K,
typename V,
typename KS>
53 boost::shared_ptr<NearCache<KS, V> >
getNearCache(
const std::string &name) {
54 return boost::static_pointer_cast<
NearCache<KS, V> >(nearCacheMap.get(name));
69 template<
typename K,
typename V,
typename KS>
72 boost::shared_ptr<BaseNearCache> nearCache = nearCacheMap.get(name);
73 if (NULL == nearCache.get()) {
75 util::LockGuard guard(mutex);
76 nearCache = nearCacheMap.get(name);
77 if (NULL == nearCache.get()) {
78 nearCache = createNearCache<K, V, KS>(name, nearCacheConfig);
79 nearCache->initialize();
81 nearCacheMap.put(name, nearCache);
95 bool clearNearCache(
const std::string &name);
100 void clearAllNearCaches();
108 bool destroyNearCache(
const std::string &name);
113 void destroyAllNearCaches();
120 std::vector<boost::shared_ptr<BaseNearCache> > listAllNearCaches();
122 template<
typename K,
typename V,
typename KS>
123 std::auto_ptr<NearCache<KS, V> > createNearCache(
125 return std::auto_ptr<NearCache<KS, V> >(
126 new impl::DefaultNearCache<K, V, KS>(
127 name, nearCacheConfig, serializationService, logger));
130 serialization::pimpl::SerializationService &serializationService;
131 util::ILogger &logger;
132 util::SynchronizedMap<std::string, BaseNearCache> nearCacheMap;
140 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) Contains the configuration for a Near Cache.
Definition: NearCacheConfig.h:44
NearCache is the contract point to store keys and values in underlying com.hazelcast.cache.impl.nearcache.NearCacheRecordStore.
Definition: NearCache.h:82
boost::shared_ptr< NearCache< KS, V > > getNearCache(const std::string &name)
Gets the NearCache instance associated with given.
Definition: NearCacheManager.h:53
NearCacheManager is the contract point to manage all existing NearCache instances.
Definition: NearCacheManager.h:39
PN (Positive-Negative) CRDT counter.
Definition: MapEntryView.h:32
boost::shared_ptr< NearCache< KS, V > > getOrCreateNearCache(const std::string &name, const client::config::NearCacheConfig< K, V > &nearCacheConfig)
Creates a new NearCache with given configurations or returns existing one.
Definition: NearCacheManager.h:70