Skip to content

feat: auction history count 전용 캐시 추가#115

Merged
dev-ant merged 2 commits intodevfrom
perf/auction-history-count-cache
Mar 5, 2026
Merged

feat: auction history count 전용 캐시 추가#115
dev-ant merged 2 commits intodevfrom
perf/auction-history-count-cache

Conversation

@dev-ant
Copy link
Copy Markdown
Contributor

@dev-ant dev-ant commented Mar 5, 2026

📋 상세 설명

  • 경매 기록 Repository의 search(Page) 메서드를 searchContent(List)와 count(long)으로 분리
    • 이를 통해 auction-history:count Redis 캐시를 사용하여 count 결과를 독립적으로 캐싱할 수 있도록 변경
  • 새로운 DB 인덱스 idx_ah_top_sub_date를 추가했습니다.
    • (item_top_category, item_sub_category, date_auction_buy DESC)
    • item_name 필터가 없는 count/search 쿼리를 최적화하기 위한 인덱스입니다.

📊 체크리스트

  • PR 제목이 형식에 맞나요 e.g. feat: PR을 등록한다
  • 코드가 테스트 되었나요
  • 문서는 업데이트 되었나요
  • 불필요한 코드를 제거했나요
  • 이슈와 라벨이 등록되었나요 이슈 미등록

@dev-ant dev-ant requested a review from Copilot March 5, 2026 23:30
@dev-ant dev-ant self-assigned this Mar 5, 2026
@dev-ant dev-ant added the ✨feature 새로운 기능 추가 label Mar 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

✅ 테스트 결과 for PR

Build: success

🧪 테스트 실행 with Gradle
📈 Coverage: -0.00%

📁 테스트 결과
📁 커버리지 보고서 (HTML)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a dedicated Redis cache for auction history count queries, separating the count from the search results to avoid redundant database count queries across different pages of the same search. It also adds a new database index to optimize category+date range queries, and refactors the repository layer to split the previous search method (returning Page) into searchContent (returning List) and count (returning long).

Changes:

  • Splits the auction history repository search(Page) method into searchContent(List) and count(long), enabling independent caching of count results via a new auction-history:count Redis cache
  • Adds a new database index (idx_ah_top_sub_date) on (item_top_category, item_sub_category, date_auction_buy DESC) to optimize count/search queries without item_name filters
  • Enables P6Spy SQL logging in application.yml (changed from false to true)

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
AuctionHistoryService.java Adds manual count cache lookup/put via CacheManager, with resolveTotalCount and isCountCacheEligible methods
AuctionHistoryQueryDslRepository.java Splits search into searchContent and count; extracts buildSearchPredicate as shared predicate builder
AuctionHistoryRepositoryPort.java Updates port interface: replaces search(Page) with searchContent(List) and count(long)
AuctionHistoryRepositoryPortImpl.java Updates port implementation to delegate to new QueryDsl methods
CacheNames.java Adds AUCTION_HISTORY_COUNT constant
RedisConfig.java Registers the new count cache with 2-hour TTL
CacheKeyBuilder.java Adds buildAuctionHistoryCountKey and extracts resolveAuctionHistoryDateRange helper
AuctionHistoryCacheWarmupService.java Evicts the new count cache alongside the search cache
V27__add_auction_history_category_date_index.sql Adds database index for category+date queries
application.yml Enables P6Spy logging
AuctionHistoryServiceTest.java Updates test mocks to match new split API

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/resources/application.yml Outdated

private void evictCaches() {
clearCache(CacheNames.AUCTION_HISTORY_SEARCH);
clearCache(CacheNames.AUCTION_HISTORY_COUNT);
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class Javadoc on line 20 lists only auction-history:search as being evicted, but the evictCaches() method now also evicts auction-history:count. The documentation should be updated to mention both caches to avoid confusion.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dev-ant dev-ant merged commit b64eae3 into dev Mar 5, 2026
1 check passed
@dev-ant dev-ant deleted the perf/auction-history-count-cache branch March 5, 2026 23:46
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 6, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨feature 새로운 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants