페이징
-
[JPA, Redis]페이지별 결과 캐싱Spring Framework 2021. 8. 11. 17:45
1. 서론 Spring Data Redis와 JPA의 페이징을 이용해서 해당 결과를 캐싱하겠습니다. 2. JPA 페이징 2. 1. query 작성 @Query("from Post") Optional findAllPosts(Pageable pageable); 모든 게시물 목록을 조회합니다 Pageable 인터페이스를 파라미터로 받습니다 2. 2. Test @Test public void findPosts() { Pageable pageRequest = PageRequest.of(0, 10); List posts = postRepository.findAllPosts(pageRequest).orElseThrow(RuntimeException::new); posts.forEach(p -> System.out.p..