Skip to content

Commit

Permalink
[fix] response dto에 동적 필드로 인한 캐싱 문제로 캐싱 비활성화
Browse files Browse the repository at this point in the history
  • Loading branch information
tlarbals824 committed May 25, 2023
1 parent a6cc9d3 commit 29e6380
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
package com.kusitms.samsion.domain.album.presentation;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.kusitms.samsion.common.consts.CachingStoreConst;
import com.kusitms.samsion.common.slice.SliceResponse;
import com.kusitms.samsion.domain.album.application.dto.request.AlbumCreateRequest;
import com.kusitms.samsion.domain.album.application.dto.request.AlbumSearchRequest;
Expand All @@ -22,8 +10,9 @@
import com.kusitms.samsion.domain.album.application.service.AlbumDeleteUseCase;
import com.kusitms.samsion.domain.album.application.service.AlbumReadUseCase;
import com.kusitms.samsion.domain.album.application.service.AlbumUpdateUseCase;

import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;

/**
* TODO : 공감, 댓글, 이미지 정보도 같이 가져와야 함
Expand Down Expand Up @@ -64,7 +53,6 @@ public AlbumInfoResponse createAlbum(@ModelAttribute AlbumCreateRequest request)
* 캐시 미적용 : 3회 warmup 4회 테스트 평균 40ms
* 캐시 적용 : 3회 warmup 4회 테스트 평균 20ms
*/
@Cacheable(value = CachingStoreConst.ALBUM_CACHE_NAME, key = "#albumId")
@GetMapping("/{albumId}")
public AlbumInfoResponse getAlbum(@PathVariable Long albumId){
return albumReadUseCase.getAlbum(albumId);
Expand All @@ -74,7 +62,6 @@ public AlbumInfoResponse getAlbum(@PathVariable Long albumId){
* 비동기 실행 : 100회 요청 4s82ms
* 동기 실행 : 100회
*/
@CacheEvict(value = CachingStoreConst.ALBUM_CACHE_NAME, key = "#albumId")
@PostMapping("/{albumId}")
public void updateAlbum(@PathVariable Long albumId, @ModelAttribute AlbumUpdateRequest request){
albumUpdateUseCase.updateAlbum(albumId, request);
Expand Down

0 comments on commit 29e6380

Please sign in to comment.