Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.time.temporal.ChronoUnit;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand All @@ -34,6 +35,7 @@ public class RentalService {
private final UserRepository userRepository;
private final PostRepository postRepository;

@CacheEvict(value = "posts", key = "#request.postId")
@Transactional
public RentalResponse createRental(Long userId, RentalRequest request) {
// 사용자 조회
Expand Down Expand Up @@ -150,6 +152,7 @@ private static RentalResponse convertToResponse(Rental rental) {
.build();
}

@CacheEvict(value = "posts", key = "#result.postId")
@Transactional
public RentalResponse cancelRental(Long userId, Long rentalId) {
// 대여 정보 조회
Expand Down