K - the type of key for this QueryCacheV - the type of value for this QueryCache@Beta public interface QueryCache<K,V>
IMap. It can be also think of an always up to date view or snapshot of the IMap.
Typically, QueryCache is used for performance reasons.
This QueryCache can be configured via QueryCacheConfig.
It can be reached like this:
IMap map = hzInstance.getMap("mapName");
Predicate predicate = TruePredicate.INSTANCE;
QueryCache cache = map.getQueryCache(cacheName, predicate, includeValue);
This cache is evictable. The eviction can be configured with evictionConfig. Events caused by IMap eviction are not reflected to this cache. But the events published after
an explicit call to IMap.evict(K) are reflected to this cache.
GOTCHAS
QueryCache implementation relies on the eventing system, if a listener is attached to this QueryCache
it may receive same event more than once in case of a system failure. Check out tryRecover()
QueryCache is reflected to underlying IMap and that
write operation will eventually be reflected to this QueryCache after receiving the
event of that operation.
IMap implementation,
one should take care of them before using this QueryCache.
Please check gotchas section in IMap class for them.
QueryCacheConfig| Modifier and Type | Method and Description |
|---|---|
String |
addEntryListener(MapListener listener,
boolean includeValue) |
String |
addEntryListener(MapListener listener,
K key,
boolean includeValue) |
String |
addEntryListener(MapListener listener,
Predicate<K,V> predicate,
boolean includeValue) |
String |
addEntryListener(MapListener listener,
Predicate<K,V> predicate,
K key,
boolean includeValue) |
void |
addIndex(String attribute,
boolean ordered) |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
void |
destroy()
Destroys this cache.
|
Set<Map.Entry<K,V>> |
entrySet() |
Set<Map.Entry<K,V>> |
entrySet(Predicate predicate) |
V |
get(Object key) |
Map<K,V> |
getAll(Set<K> keys) |
String |
getName()
Returns the name of this
QueryCache. |
boolean |
isEmpty() |
Set<K> |
keySet() |
Set<K> |
keySet(Predicate predicate) |
boolean |
removeEntryListener(String id) |
int |
size() |
boolean |
tryRecover()
This method can be used to recover from a possible event loss situation.
|
Collection<V> |
values() |
Collection<V> |
values(Predicate predicate) |
V get(Object key)
IMap.get(Object)boolean containsKey(Object key)
IMap.containsKey(Object)boolean containsValue(Object value)
IMap.containsValue(Object)boolean isEmpty()
Map.isEmpty()int size()
Map.size()void addIndex(String attribute, boolean ordered)
IMap.addIndex(String, boolean)Set<K> keySet()
IMap.keySet()Set<K> keySet(Predicate predicate)
IMap.keySet(Predicate)Set<Map.Entry<K,V>> entrySet()
IMap.entrySet()Collection<V> values()
IMap.values()Collection<V> values(Predicate predicate)
IMap.values(Predicate)String addEntryListener(MapListener listener, boolean includeValue)
String addEntryListener(MapListener listener, K key, boolean includeValue)
String addEntryListener(MapListener listener, Predicate<K,V> predicate, boolean includeValue)
String addEntryListener(MapListener listener, Predicate<K,V> predicate, K key, boolean includeValue)
boolean removeEntryListener(String id)
IMap.removeEntryListener(String)String getName()
QueryCache. The returned value will never be null.QueryCache.boolean tryRecover()
QueryCache with the data in the underlying IMap
by replaying the events after last consistently received ones. As a result of this replaying logic, same event may
appear more than once to the QueryCache listeners.
This method returns false if the event is not in the buffer of event publisher side. That means recovery is not
possible.true if the QueryCache content will be eventually consistent, otherwise false.QueryCacheConfig.bufferSizevoid destroy()
Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.