Class LoomQueryCache<K,V>
java.lang.Object
com.loomcache.client.query.LoomQueryCache<K,V>
- All Implemented Interfaces:
AutoCloseable
A continuous-query cache (CQC) that maintains a local materialized view of the cluster entries
matching a given predicate.
On creation the cache seeds itself from the cluster via a scan, then receives incremental
updates as matching entries are added, changed, or removed. Register CQCListener
callbacks to be notified of changes to the view. The view is bounded only by the predicate;
close the cache when done to stop receiving updates.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final record -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(LoomQueryCache.CQCListener<K, V> listener) voidclose()booleancontainsKey(K key) static <K,V> LoomQueryCache <K, V> create(LoomClient client, String sourceMapName, BiPredicate<K, V> predicate, Class<K> keyType, Class<V> valueType) static <K,V> LoomQueryCache <K, V> create(LoomClient client, String sourceMapName, BiPredicate<K, V> predicate, Class<K> keyType, Class<V> valueType, LoomQueryCacheConfig config) static <K,V> LoomQueryCache <K, V> createServerFiltered(LoomClient client, String sourceMapName, SerializablePredicate serverPredicate, Class<K> keyType, Class<V> valueType) static <K,V> LoomQueryCache <K, V> createServerFiltered(LoomClient client, String sourceMapName, SerializablePredicate serverPredicate, Class<K> keyType, Class<V> valueType, LoomQueryCacheConfig config) @Nullable VbooleanisActive()booleanisEmpty()keySet()booleanremoveListener(LoomQueryCache.CQCListener<K, V> listener) intsize()snapshot()values()
-
Method Details
-
create
public static <K,V> LoomQueryCache<K,V> create(LoomClient client, String sourceMapName, BiPredicate<K, V> predicate, Class<K> keyType, Class<V> valueType) -
create
public static <K,V> LoomQueryCache<K,V> create(LoomClient client, String sourceMapName, BiPredicate<K, V> predicate, Class<K> keyType, Class<V> valueType, LoomQueryCacheConfig config) -
createServerFiltered
public static <K,V> LoomQueryCache<K,V> createServerFiltered(LoomClient client, String sourceMapName, SerializablePredicate serverPredicate, Class<K> keyType, Class<V> valueType) -
createServerFiltered
public static <K,V> LoomQueryCache<K,V> createServerFiltered(LoomClient client, String sourceMapName, SerializablePredicate serverPredicate, Class<K> keyType, Class<V> valueType, LoomQueryCacheConfig config) -
get
-
containsKey
-
size
public int size() -
isEmpty
public boolean isEmpty() -
snapshot
-
keySet
-
values
-
isActive
public boolean isActive() -
addListener
-
removeListener
-
getStatistics
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-