Skip to content

지원 대학 상세 캐시 미eviction: 어드민 수정 후 상세 페이지 stale 반환 #780

@whqtker

Description

@whqtker

문제

getUnivApplyInfoDetail은 결과를 univApplyInfo:{id} 키로 86400초간 캐싱하지만, 어드민 update/delete 시 eviction 대상에서 누락되어 있습니다.

현재 updateUnivApplyInfo·deleteUnivApplyInfo@DefaultCacheOut은 아래 두 키만 evict합니다.

  • univApplyInfoTextSearch* (prefix)
  • university:recommend:general* (prefix)

univApplyInfo:{id} 키는 포함되지 않아, 어드민이 항목을 수정해도 상세 페이지는 최대 24시간 동안 변경 전 데이터를 반환합니다.

원인

@DefaultCacheOutprefix 플래그가 key[] 배열 전체에 단일 적용되므로, prefix eviction(검색·추천)과 exact eviction(univApplyInfo:{id})을 하나의 어노테이션에서 혼용할 수 없습니다.

해결 방안

@DefaultCacheOut을 반복 가능한(Repeatable) 어노테이션으로 변경하여, prefix/exact eviction을 분리 선언합니다.

  1. DefaultCacheOut@Repeatable(DefaultCacheOuts.class) 추가
  2. 컨테이너 어노테이션 DefaultCacheOuts.java 생성
  3. CachingAspect@DefaultCacheOuts 처리 로직 추가
  4. updateUnivApplyInfo·deleteUnivApplyInfo에 두 번째 @DefaultCacheOut 추가
@DefaultCacheOut(
    key = {"univApplyInfoTextSearch", "university:recommend:general"},
    cacheManager = "customCacheManager",
    prefix = true
)
@DefaultCacheOut(
    key = {"univApplyInfo:{0}"},
    cacheManager = "customCacheManager"
)
public AdminUnivApplyInfoResponse updateUnivApplyInfo(Long id, ...) { ... }

영향 범위

  • AdminUnivApplyInfoService.updateUnivApplyInfo
  • AdminUnivApplyInfoService.deleteUnivApplyInfo
  • CachingAspect, DefaultCacheOut, 신규 DefaultCacheOuts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions