File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
java-redis/src/test/java/org/cp/javaredis Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -42,4 +42,26 @@ public void compareTest() {
4242 System .out .println ("set count: " + set .size ());
4343 }
4444
45+ @ Test
46+ public void mergeTest () {
47+ RHyperLogLog <String > today = redisson .getHyperLogLog ("UV_" + LocalDate .now ());
48+ RHyperLogLog <String > nextDay = redisson .getHyperLogLog ("UV_" + LocalDate .now ().plusDays (1 ));
49+ today .delete ();
50+ HashSet <String > set = new HashSet <>();
51+ Random random = new Random ();
52+ for (int i = 0 ; i < 1000 ; i ++) {
53+ String userId = "id_" + random .nextInt (1000 );
54+ today .add (userId );
55+ set .add (userId );
56+ }
57+ for (int i = 0 ; i < 1000 ; i ++) {
58+ String userId = "id_" + random .nextInt (2000 );
59+ nextDay .add (userId );
60+ set .add (userId );
61+ }
62+ today .mergeWith (nextDay .getName ());
63+ System .out .println ("RHyperLogLog: " + today .count ());
64+ System .out .println ("set count: " + set .size ());
65+ }
66+
4567}
You can’t perform that action at this time.
0 commit comments