Search in sources :

Example 6 with MetadataAwareValue

use of com.hazelcast.map.EntryLoader.MetadataAwareValue in project hazelcast by hazelcast.

the class WriteThroughStore method add.

@Override
public Object add(Data key, Object value, long expirationTime, long time, UUID transactionId) {
    Object objectKey = toObject(key);
    Object objectValue = toObject(value);
    if (getStore().isWithExpirationTime()) {
        expirationTime = getUserExpirationTime(expirationTime);
        getStore().store(objectKey, new MetadataAwareValue(objectValue, expirationTime));
    } else {
        getStore().store(objectKey, objectValue);
    }
    // if store is not a post-processing map-store, then avoid extra de-serialization phase.
    return getStore().isPostProcessingMapStore() ? objectValue : value;
}
Also used : MetadataAwareValue(com.hazelcast.map.EntryLoader.MetadataAwareValue)

Example 7 with MetadataAwareValue

use of com.hazelcast.map.EntryLoader.MetadataAwareValue in project hazelcast by hazelcast.

the class ExtendedValueTest method testWithNoDate.

@Test
public void testWithNoDate() {
    MetadataAwareValue entry = new MetadataAwareValue<>("value");
    assertEquals(NO_TIME_SET, entry.getExpirationTime());
}
Also used : MetadataAwareValue(com.hazelcast.map.EntryLoader.MetadataAwareValue) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

MetadataAwareValue (com.hazelcast.map.EntryLoader.MetadataAwareValue)7 Data (com.hazelcast.internal.serialization.Data)3 DelayedEntry (com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry)2 Record (com.hazelcast.map.impl.record.Record)2 Map (java.util.Map)2 MapUtil.createHashMap (com.hazelcast.internal.util.MapUtil.createHashMap)1 EntryEventData (com.hazelcast.map.impl.event.EntryEventData)1 DelayedEntries.newAddedDelayedEntry (com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntries.newAddedDelayedEntry)1 MergingValueFactory.createMergingEntry (com.hazelcast.spi.impl.merge.MergingValueFactory.createMergingEntry)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 Test (org.junit.Test)1