use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class AbstractInternalQueryCache method doFullValueScan.
protected void doFullValueScan(Predicate predicate, Set<V> resultingSet) {
InternalSerializationService serializationService = this.serializationService;
CachedQueryEntry queryEntry = new CachedQueryEntry();
Set<Map.Entry<Data, QueryCacheRecord>> entries = recordStore.entrySet();
for (Map.Entry<Data, QueryCacheRecord> entry : entries) {
Data keyData = entry.getKey();
QueryCacheRecord record = entry.getValue();
Object value = record.getValue();
queryEntry.init(serializationService, keyData, value, Extractors.empty());
boolean valid = predicate.apply(queryEntry);
if (valid) {
Object valueObject = queryEntry.getValue();
resultingSet.add((V) valueObject);
}
}
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class AbstractInternalQueryCache method doFullEntryScan.
protected void doFullEntryScan(Predicate predicate, Set<Map.Entry<K, V>> resultingSet) {
InternalSerializationService serializationService = this.serializationService;
CachedQueryEntry queryEntry = new CachedQueryEntry();
Set<Map.Entry<Data, QueryCacheRecord>> entries = recordStore.entrySet();
for (Map.Entry<Data, QueryCacheRecord> entry : entries) {
Data keyData = entry.getKey();
QueryCacheRecord record = entry.getValue();
Object value = record.getValue();
queryEntry.init(serializationService, keyData, value, Extractors.empty());
boolean valid = predicate.apply(queryEntry);
if (valid) {
Object keyObject = queryEntry.getKey();
Object valueObject = queryEntry.getValue();
Map.Entry simpleEntry = new AbstractMap.SimpleEntry(keyObject, valueObject);
resultingSet.add(simpleEntry);
}
}
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class DefaultQueryCache method deleteInternal.
@Override
public void deleteInternal(Object key, boolean callDelegate, EntryEventType eventType) {
checkNotNull(key, "key cannot be null");
Data keyData = toData(key);
if (callDelegate) {
getDelegate().delete(keyData);
}
QueryCacheRecord oldRecord = recordStore.remove(keyData);
if (oldRecord == null) {
return;
}
if (eventType != null) {
EventPublisherHelper.publishEntryEvent(context, mapName, cacheName, keyData, null, oldRecord, eventType);
}
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class DefaultQueryCache method delete.
@Override
public void delete(Object key, EntryEventType eventType) {
checkNotNull(key, "key cannot be null");
Object queryCacheKey = recordStore.toQueryCacheKey(key);
QueryCacheRecord oldRecord = recordStore.remove(queryCacheKey);
if (oldRecord == null) {
return;
}
if (eventType != null) {
publishEntryEvent(context, mapName, cacheId, queryCacheKey, null, oldRecord, eventType, extractors);
}
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class DefaultQueryCache method getAll.
@Override
public Map<K, V> getAll(Set<K> keys) {
checkNotNull(keys, "keys cannot be null");
checkNoNullInside(keys, "supplied key-set cannot contain null key");
if (keys.isEmpty()) {
return Collections.emptyMap();
}
if (!includeValue) {
return getDelegate().getAll(keys);
}
Map<K, V> map = MapUtil.createHashMap(keys.size());
for (K key : keys) {
Object queryCacheKey = recordStore.toQueryCacheKey(key);
QueryCacheRecord record = recordStore.get(queryCacheKey);
if (record != null) {
V value = toObject(record.getValue());
map.put(key, value);
}
}
return map;
}
Aggregations