File tree 3 files changed +4
-4
lines changed
spring/cacheable/src/main/java/com/example/cacheabledemo
3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public class Webtoon implements Serializable {
21
21
@ Column (name = "webtoon_id" )
22
22
private Long id ;
23
23
24
- @ Column (name = "webtoon_no" , unique = true )
24
+ @ Column (name = "webtoon_no" )
25
25
private String webtoonNo ;
26
26
27
27
private String title ;
Original file line number Diff line number Diff line change 7
7
import java .util .List ;
8
8
9
9
public interface WebtoonRepository extends JpaRepository <Webtoon , Long > {
10
- List <Webtoon > findByDayOfWeek (DayOfWeek dayOfWeek );
10
+ List <Webtoon > findTop50ByDayOfWeek (DayOfWeek dayOfWeek );
11
11
}
Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ public class WebtoonService {
21
21
22
22
public List <Webtoon > getTodayWebtoon () {
23
23
DayOfWeek todayDayOfWeek = LocalDate .now ().getDayOfWeek ();
24
- return webtoonRepository .findByDayOfWeek (todayDayOfWeek );
24
+ return webtoonRepository .findTop50ByDayOfWeek (todayDayOfWeek );
25
25
}
26
26
27
27
@ Cacheable (value = CacheKey .TODAY_WEBTOON , key = "0" )
28
28
public List <Webtoon > getTodayWebtoonWithCache () {
29
29
DayOfWeek todayDayOfWeek = LocalDate .now ().getDayOfWeek ();
30
- return webtoonRepository .findByDayOfWeek (todayDayOfWeek );
30
+ return webtoonRepository .findTop50ByDayOfWeek (todayDayOfWeek );
31
31
}
32
32
}
You can’t perform that action at this time.
0 commit comments