File tree Expand file tree Collapse file tree
src/main/java/com/rentify/rentify_api/rental/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import java .time .temporal .ChronoUnit ;
2121import java .util .List ;
2222import lombok .RequiredArgsConstructor ;
23+ import org .springframework .cache .annotation .CacheEvict ;
2324import org .springframework .data .domain .Page ;
2425import org .springframework .data .domain .Pageable ;
2526import org .springframework .stereotype .Service ;
@@ -34,6 +35,7 @@ public class RentalService {
3435 private final UserRepository userRepository ;
3536 private final PostRepository postRepository ;
3637
38+ @ CacheEvict (value = "posts" , key = "#request.postId" )
3739 @ Transactional
3840 public RentalResponse createRental (Long userId , RentalRequest request ) {
3941 // 사용자 조회
@@ -150,6 +152,7 @@ private static RentalResponse convertToResponse(Rental rental) {
150152 .build ();
151153 }
152154
155+ @ CacheEvict (value = "posts" , key = "#result.postId" )
153156 @ Transactional
154157 public RentalResponse cancelRental (Long userId , Long rentalId ) {
155158 // 대여 정보 조회
You can’t perform that action at this time.
0 commit comments