Skip to content

Commit a10430d

Browse files
fix: 스탬프/미션 변경 시 여행 상세 조회 캐시 무효화 누락 수정(#85)
* refactor: StampFacade 등록/수정/삭제/완료 메서드에 @CacheEvict(cacheNames = TRIP), @CacheEvict(cacheNames = TRIPS) 추가하여 캐시 무효화 적용 * refactor: MissionFacade 등록/수정/삭제 메서드에 @CacheEvict(cacheNames = TRIP), @CacheEvict(cacheNames = TRIPS) 추가하여 캐시 무효화 적용
1 parent 37981eb commit a10430d

2 files changed

Lines changed: 36 additions & 8 deletions

File tree

src/main/java/com/ject/studytrip/mission/application/facade/MissionFacade.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ public class MissionFacade {
4141
@CacheEvict(
4242
cacheNames = STAMP,
4343
key =
44-
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)")
44+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)"),
45+
@CacheEvict(
46+
cacheNames = TRIP,
47+
key =
48+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
49+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
4550
})
4651
@Transactional
4752
public MissionInfo createMission(
@@ -62,7 +67,12 @@ public MissionInfo createMission(
6267
@CacheEvict(
6368
cacheNames = STAMP,
6469
key =
65-
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)")
70+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)"),
71+
@CacheEvict(
72+
cacheNames = TRIP,
73+
key =
74+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
75+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
6676
})
6777
@Transactional
6878
public void updateMissionNameIfPresent(
@@ -86,7 +96,12 @@ public void updateMissionNameIfPresent(
8696
@CacheEvict(
8797
cacheNames = STAMP,
8898
key =
89-
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)")
99+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)"),
100+
@CacheEvict(
101+
cacheNames = TRIP,
102+
key =
103+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
104+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
90105
})
91106
@Transactional
92107
public void deleteMission(Long memberId, Long tripId, Long stampId, Long missionId) {

src/main/java/com/ject/studytrip/stamp/application/facade/StampFacade.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public class StampFacade {
4646
@CacheEvict(
4747
cacheNames = TRIP,
4848
key =
49-
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)")
49+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
50+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
5051
})
5152
@Transactional
5253
public StampInfo createStamp(Long memberId, Long tripId, CreateStampRequest request) {
@@ -66,7 +67,12 @@ public StampInfo createStamp(Long memberId, Long tripId, CreateStampRequest requ
6667
@CacheEvict(
6768
cacheNames = STAMP,
6869
key =
69-
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)")
70+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamp(#memberId, #tripId, #stampId)"),
71+
@CacheEvict(
72+
cacheNames = TRIP,
73+
key =
74+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
75+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
7076
})
7177
@Transactional
7278
public void updateStamp(Long memberId, Long tripId, Long stampId, UpdateStampRequest request) {
@@ -82,7 +88,12 @@ public void updateStamp(Long memberId, Long tripId, Long stampId, UpdateStampReq
8288
cacheNames = STAMPS,
8389
key =
8490
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).stamps(#memberId, #tripId)"),
85-
@CacheEvict(cacheNames = STAMP, allEntries = true)
91+
@CacheEvict(cacheNames = STAMP, allEntries = true),
92+
@CacheEvict(
93+
cacheNames = TRIP,
94+
key =
95+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
96+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
8697
})
8798
@Transactional
8899
public void updateStampOrders(Long memberId, Long tripId, UpdateStampOrderRequest request) {
@@ -104,7 +115,8 @@ public void updateStampOrders(Long memberId, Long tripId, UpdateStampOrderReques
104115
@CacheEvict(
105116
cacheNames = TRIP,
106117
key =
107-
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)")
118+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
119+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
108120
})
109121
@Transactional
110122
public void deleteStamp(Long memberId, Long tripId, Long stampId) {
@@ -154,7 +166,8 @@ public StampDetail getStamp(Long memberId, Long tripId, Long stampId) {
154166
@CacheEvict(
155167
cacheNames = TRIP,
156168
key =
157-
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)")
169+
"T(com.ject.studytrip.global.common.factory.CacheKeyFactory).trip(#memberId, #tripId)"),
170+
@CacheEvict(cacheNames = TRIPS, allEntries = true)
158171
})
159172
@Transactional
160173
public void completeStamp(Long memberId, Long tripId, Long stampId) {

0 commit comments

Comments
 (0)