use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class AbstractInternalQueryCache method doFullKeyScan.
protected void doFullKeyScan(Predicate predicate, Set<K> 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) {
resultingSet.add((K) queryEntry.getKey());
}
}
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class DefaultQueryCacheRecordStore method add.
@Override
public QueryCacheRecord add(Data keyData, Data valueData) {
evictionOperator.evictIfRequired();
QueryCacheRecord entry = recordFactory.createEntry(keyData, valueData);
QueryCacheRecord oldEntry = cache.put(keyData, entry);
saveIndex(keyData, entry, oldEntry);
return oldEntry;
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class DefaultQueryCache method addIndex.
@Override
public void addIndex(String attribute, boolean ordered) {
getIndexes().addOrGetIndex(attribute, ordered);
InternalSerializationService serializationService = context.getSerializationService();
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 queryable = new QueryEntry(serializationService, keyData, value, Extractors.empty());
indexes.saveEntryIndex(queryable, null);
}
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class DefaultQueryCache method setInternal.
@Override
public void setInternal(K key, V value, boolean callDelegate, EntryEventType eventType) {
Data keyData = toData(key);
Data valueData = toData(value);
if (callDelegate) {
getDelegate().set(keyData, valueData);
}
QueryCacheRecord oldRecord = recordStore.add(keyData, valueData);
if (eventType != null) {
EventPublisherHelper.publishEntryEvent(context, mapName, cacheName, keyData, valueData, oldRecord, eventType);
}
}
use of com.hazelcast.map.impl.querycache.subscriber.record.QueryCacheRecord in project hazelcast by hazelcast.
the class DefaultQueryCacheRecordStore method clear.
@Override
public int clear() {
int removeCount = 0;
Set<Data> dataKeys = keySet();
for (Data dataKey : dataKeys) {
QueryCacheRecord oldRecord = remove(dataKey);
if (oldRecord != null) {
removeCount++;
}
}
return removeCount;
}
Aggregations