1
1
package com .redis .cluster ;
2
2
3
+ import lombok .extern .slf4j .Slf4j ;
3
4
import org .junit .Test ;
4
5
import org .junit .runner .RunWith ;
5
6
import org .springframework .beans .factory .annotation .Autowired ;
13
14
14
15
import java .util .*;
15
16
17
+ @ Slf4j
16
18
@ RunWith (SpringRunner .class )
17
19
@ SpringBootTest
18
20
public class ReactiveRedisClusterTest {
@@ -30,22 +32,19 @@ public class ReactiveRedisClusterTest {
30
32
public void opsValue () {
31
33
ReactiveValueOperations <String , String > valueOps = reactiveRedisTemplate .opsForValue ();
32
34
Set <String > cacheKeys = new HashSet <>();
33
- Map <String , String > setDatas = new HashMap <>();
34
- for (int i = 0 ; i < 10 ; i ++) {
35
+ // async process
36
+ log .info ("Step-1" );
37
+ for (int i = 0 ; i < 5000 ; i ++) {
35
38
String key = "value_" + i ;
36
39
cacheKeys .add (key );
37
- setDatas . put (key , String .valueOf (i ));
40
+ valueOps . set (key , String .valueOf (i ));
38
41
}
39
- // previous key delete - sync process
40
- redisTemplate .delete (cacheKeys );
41
-
42
- // async process
43
- Mono <Boolean > results = valueOps .multiSet (setDatas );
44
- StepVerifier .create (results ).expectNext (true ).verifyComplete ();
45
-
42
+ log .info ("Step-2" );
46
43
Mono <List <String >> values = valueOps .multiGet (cacheKeys );
44
+ log .info ("Step-3" );
47
45
StepVerifier .create (values )
48
- .expectNextMatches (x -> x .size () == 10 ).verifyComplete ();
46
+ .expectNextMatches (x -> x .size () == 5000 ).verifyComplete ();
47
+ log .info ("Step-4" );
49
48
}
50
49
51
50
/**
0 commit comments