Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2a82919

Browse filesBrowse files
author
akuksin
committed
Merge branch 'master' into cache
# Conflicts: # spring-boot/hazelcast/hazelcast-client-server/src/test/java/io/reflectoring/cache/cleint/AbstractIntegrationTest.java
2 parents 60f6c7e + 31c09ae commit 2a82919
Copy full SHA for 2a82919

File tree

Expand file treeCollapse file tree

3 files changed

+27
-11
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+27
-11
lines changed
Open diff view settings
Collapse file

‎spring-boot/hazelcast/hazelcast-client-server/build.gradle‎

Copy file name to clipboardExpand all lines: spring-boot/hazelcast/hazelcast-client-server/build.gradle
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies {
2222
implementation 'org.springframework.boot:spring-boot-starter-web'
2323
compileOnly 'org.projectlombok:lombok'
2424
annotationProcessor 'org.projectlombok:lombok'
25-
compile group: 'com.hazelcast', name: 'hazelcast-client', version: '3.12.7'
25+
compile group: 'com.hazelcast', name: 'hazelcast', version: '4.0.1'
2626
testImplementation('org.springframework.boot:spring-boot-starter-test') {
2727
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
2828
}
Collapse file
+20-4Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package io.reflectoring.cache.cleint.client;
22

33
import com.hazelcast.client.HazelcastClient;
4+
import com.hazelcast.client.config.ClientConfig;
5+
import com.hazelcast.config.NearCacheConfig;
46
import com.hazelcast.core.HazelcastInstance;
5-
import com.hazelcast.core.IMap;
7+
import com.hazelcast.map.IMap;
68
import io.reflectoring.cache.cleint.rest.Car;
79
import org.springframework.stereotype.Component;
810

@@ -11,15 +13,29 @@ public class CacheClient {
1113

1214
private static final String CARS = "cars";
1315

14-
private HazelcastInstance client = HazelcastClient.newHazelcastClient();
16+
private HazelcastInstance client = HazelcastClient.newHazelcastClient(creatClientConfig());
1517

16-
public Car put(String key, Car car){
18+
public Car put(String key, Car car) {
1719
IMap<String, Car> map = client.getMap(CARS);
1820
return map.putIfAbsent(key, car);
1921
}
2022

21-
public Car get(String key){
23+
public Car get(String key) {
2224
IMap<String, Car> map = client.getMap(CARS);
2325
return map.get(key);
2426
}
27+
28+
private ClientConfig creatClientConfig() {
29+
ClientConfig clientConfig = new ClientConfig();
30+
clientConfig.addNearCacheConfig(createNearCacheConfig());
31+
return clientConfig;
32+
}
33+
34+
private NearCacheConfig createNearCacheConfig() {
35+
NearCacheConfig nearCacheConfig = new NearCacheConfig();
36+
nearCacheConfig.setName(CARS);
37+
nearCacheConfig.setTimeToLiveSeconds(360);
38+
nearCacheConfig.setMaxIdleSeconds(60);
39+
return nearCacheConfig;
40+
}
2541
}
Collapse file

‎spring-boot/hazelcast/hazelcast-client-server/src/test/java/io/reflectoring/cache/cleint/AbstractIntegrationTest.java‎

Copy file name to clipboardExpand all lines: spring-boot/hazelcast/hazelcast-client-server/src/test/java/io/reflectoring/cache/cleint/AbstractIntegrationTest.java
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
public class AbstractIntegrationTest {
88

9-
static GenericContainer firstMember =
10-
new FixedHostPortGenericContainer("hazelcast/hazelcast:4.0.1")
11-
.withFixedExposedPort(5701, 5701);
9+
static GenericContainer firstMember =
10+
new FixedHostPortGenericContainer("hazelcast/hazelcast:4.0.1")
11+
.withFixedExposedPort(5701, 5701);
1212

13-
static GenericContainer secondMember =
14-
new FixedHostPortGenericContainer("hazelcast/hazelcast:4.0.1")
15-
.withFixedExposedPort(5702, 5701);
13+
static GenericContainer secondMember =
14+
new FixedHostPortGenericContainer("hazelcast/hazelcast:4.0.1")
15+
.withFixedExposedPort(5702, 5701);
1616

1717
@BeforeAll
1818
public static void init() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.