8 #ifndef INCLUDE_INFINISPAN_HOTROD_CACHECLIENTLISTENER_H_ 9 #define INCLUDE_INFINISPAN_HOTROD_CACHECLIENTLISTENER_H_ 27 template <
class K,
class V>
32 template <
class K,
class V>
37 static const unsigned char INTEREST_FLAG_CREATED = 0x01;
38 static const unsigned char INTEREST_FLAG_MODIFIED = 0x02;
39 static const unsigned char INTEREST_FLAG_REMOVED = 0x04;
40 static const unsigned char INTEREST_FLAG_EXPIRED = 0x08;
41 static const unsigned char INTEREST_FLAG_ALL = 0x0f;
47 interestFlag|=INTEREST_FLAG_CREATED;
48 createdCallbacks.push_back(callback);
51 interestFlag|=INTEREST_FLAG_EXPIRED;
52 expiredCallbacks.push_back(callback);
55 interestFlag|=INTEREST_FLAG_MODIFIED;
56 modifiedCallbacks.push_back(callback);
59 interestFlag|=INTEREST_FLAG_REMOVED;
60 removedCallbacks.push_back(callback);
63 interestFlag|=INTEREST_FLAG_ALL;
64 customCallbacks.push_back(callback);
69 K* key= (K*)cache.baseKeyUnmarshall(marshEv.getKey());
72 for (
auto callable: createdCallbacks)
80 K* key= (K*)cache.baseKeyUnmarshall(marshEv.getKey());
83 for (
auto callable: modifiedCallbacks)
91 K* key= (K*)cache.baseKeyUnmarshall(marshEv.getKey());
94 for (
auto callable: removedCallbacks)
102 K* key= (K*)cache.baseKeyUnmarshall(marshEv.getKey());
105 for (
auto callable: expiredCallbacks)
107 callable(typedEvent);
113 for (
auto callable: customCallbacks)
119 std::list<std::function<void(ClientCacheEntryCreatedEvent<K>)>> createdCallbacks;
120 std::list<std::function<void(ClientCacheEntryExpiredEvent<K>)>> expiredCallbacks;
121 std::list<std::function<void(ClientCacheEntryModifiedEvent<K>)>> modifiedCallbacks;
122 std::list<std::function<void(ClientCacheEntryRemovedEvent<K>)>> removedCallbacks;
123 std::list<std::function<void(ClientCacheEntryCustomEvent)>> customCallbacks;
Definition: ClientEvent.h:120
virtual void processEvent(ClientCacheEntryExpiredEvent< std::vector< char >> marshEv, std::vector< char >listId, uint8_t isCustom) const
Definition: CacheClientListener.h:100
virtual void processEvent(ClientCacheEntryRemovedEvent< std::vector< char >> marshEv, std::vector< char >listId, uint8_t isCustom) const
Definition: CacheClientListener.h:89
void add_listener(std::function< void(ClientCacheEntryRemovedEvent< K >)> callback)
Definition: CacheClientListener.h:58
Definition: ClientEvent.h:145
Definition: CacheClientListener.h:28
RemoteCacheBase & cache
Definition: CacheClientListener.h:43
Definition: AuthenticationConfiguration.h:10
void add_listener(std::function< void(ClientCacheEntryModifiedEvent< K >)> callback)
Definition: CacheClientListener.h:54
virtual void processEvent(ClientCacheEntryCreatedEvent< std::vector< char >> marshEv, std::vector< char >listId, uint8_t isCustom) const
Definition: CacheClientListener.h:67
Definition: ClientEvent.h:104
Definition: ClientEvent.h:71
virtual void processEvent(ClientCacheEntryModifiedEvent< std::vector< char >> marshEv, std::vector< char >listId, uint8_t isCustom) const
Definition: CacheClientListener.h:78
Definition: ClientListener.h:35
virtual void processEvent(ClientCacheEntryCustomEvent ev, std::vector< char >listId, uint8_t isCustom) const
Definition: CacheClientListener.h:111
Definition: AuthenticationConfiguration.h:11
Definition: CacheClientListener.h:33
void add_listener(std::function< void(ClientCacheEntryExpiredEvent< K >)> callback)
Definition: CacheClientListener.h:50
void add_listener(std::function< void(ClientCacheEntryCreatedEvent< K >)> callback)
Definition: CacheClientListener.h:46
void add_listener(std::function< void(ClientCacheEntryCustomEvent)> callback)
Definition: CacheClientListener.h:62
Definition: ClientEvent.h:38
CacheClientListener(RemoteCache< K, V > &cache)
Definition: CacheClientListener.h:45