use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class InvalidationMemberAddRemoveTest method createNearCacheConfig.
@Override
protected NearCacheConfig createNearCacheConfig(InMemoryFormat inMemoryFormat) {
NearCacheConfig nearCacheConfig = super.createNearCacheConfig(inMemoryFormat);
nearCacheConfig.setInvalidateOnChange(true).getEvictionConfig().setMaximumSizePolicy(ENTRY_COUNT).setSize(MAX_VALUE);
return nearCacheConfig;
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class InvalidationMetadataDistortionTest method createNearCacheConfig.
@Override
protected NearCacheConfig createNearCacheConfig(InMemoryFormat inMemoryFormat) {
NearCacheConfig nearCacheConfig = super.createNearCacheConfig(inMemoryFormat);
nearCacheConfig.setInvalidateOnChange(true).getEvictionConfig().setMaximumSizePolicy(ENTRY_COUNT).setSize(MAX_VALUE);
return nearCacheConfig;
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientCacheProxyTest method isCacheOnUpdate_not_prints_warning_message_for_policy_CACHE_ON_UPDATE.
@Test
public void isCacheOnUpdate_not_prints_warning_message_for_policy_CACHE_ON_UPDATE() throws Exception {
NearCacheConfig nearCacheConfig = new NearCacheConfig().setLocalUpdatePolicy(CACHE_ON_UPDATE);
TestLogger logger = new TestLogger();
new ClientCacheProxy(new CacheConfig()).isCacheOnUpdate(nearCacheConfig, "cacheName", logger);
assertNull(logger.message);
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientNearCacheTestSupport method putToCacheAndRemoveFromOtherNodeThenCantGetUpdatedFromClientNearCache.
protected void putToCacheAndRemoveFromOtherNodeThenCantGetUpdatedFromClientNearCache(InMemoryFormat inMemoryFormat) {
NearCacheConfig nearCacheConfig = createNearCacheConfig(inMemoryFormat);
nearCacheConfig.setInvalidateOnChange(true);
NearCacheTestContext nearCacheTestContext1 = createNearCacheTest(DEFAULT_CACHE_NAME, nearCacheConfig);
final NearCacheTestContext nearCacheTestContext2 = createNearCacheTest(DEFAULT_CACHE_NAME, nearCacheConfig);
// put cache record from client-1
for (int i = 0; i < DEFAULT_RECORD_COUNT; i++) {
nearCacheTestContext1.cache.put(i, generateValueFromKey(i));
}
// get records from client-2
for (int i = 0; i < DEFAULT_RECORD_COUNT; i++) {
final Integer key = i;
final String value = nearCacheTestContext2.cache.get(key);
// records are stored in the cache as async not sync, so these records will be there in cache eventually
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
Data keyData = nearCacheTestContext2.serializationService.toData(key);
assertEquals(value, nearCacheTestContext2.nearCache.get(keyData));
}
});
}
// delete cache record from client-1
for (int i = 0; i < DEFAULT_RECORD_COUNT; i++) {
nearCacheTestContext1.cache.remove(i);
}
// can't get deleted records from client-2
for (int i = 0; i < DEFAULT_RECORD_COUNT; i++) {
final int key = i;
// records are stored in the Near Cache will be invalidated eventually, since cache records are updated.
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
Data keyData = nearCacheTestContext2.serializationService.toData(key);
assertNull(nearCacheTestContext2.nearCache.get(keyData));
}
});
}
}
use of com.hazelcast.config.NearCacheConfig in project hazelcast by hazelcast.
the class ClientNearCacheTestSupport method putAndGetFromCacheAndThenGetFromClientNearCache.
protected void putAndGetFromCacheAndThenGetFromClientNearCache(InMemoryFormat inMemoryFormat) {
NearCacheConfig nearCacheConfig = createNearCacheConfig(inMemoryFormat);
NearCacheTestContext nearCacheTestContext = createNearCacheTestAndFillWithData(DEFAULT_CACHE_NAME, nearCacheConfig);
for (int i = 0; i < DEFAULT_RECORD_COUNT; i++) {
assertNull(nearCacheTestContext.nearCache.get(nearCacheTestContext.serializationService.toData(i)));
}
for (int i = 0; i < DEFAULT_RECORD_COUNT; i++) {
// get records so they will be stored in Near Cache
nearCacheTestContext.cache.get(i);
}
for (int i = 0; i < DEFAULT_RECORD_COUNT; i++) {
String expectedValue = generateValueFromKey(i);
Data keyData = nearCacheTestContext.serializationService.toData(i);
assertEquals(expectedValue, nearCacheTestContext.nearCache.get(keyData));
}
}
Aggregations