Skip to content

Conversation

@kongwoojin
Copy link
Member

PR 개요

PR 체크리스트

  • Code convention을 잘 지켰나요?
  • Lint check를 수행하였나요?
  • Assignees를 추가했나요?

작업사항

  • 버그 수정
  • 신규 기능
  • 코드 스타일 수정 (포맷팅 등)
  • 리팩토링 (기능 수정 X, API 수정 X)
  • 기타

작업사항의 상세한 설명

  • Room dependency를 추가했습니다.
  • 캐싱을 위한 CacheMetadataDao를 추가했습니다. cacheKey를 활용해서 캐싱된 시간을 저장하시면 됩니다.
  • Room을 사용한 상점 카테고리 캐싱 로직을 구현했습니다.
    • 상점 카테고리 데이터는 사실상 변하지 않기 때문에, 별도의 검증 로직은 구현하지 않았습니다. (단 한번도 변한 적 없음)
    • 캐시 만료 주기는 7일입니다.
    • 현재 백엔드에서 별도의 캐시 검증을 위한 로직을 제공하지 않아, 별도의 검증은 불가능합니다.

논의 사항

  • 캐시 만료 주기에 대한 조정이 필요할까요

스크린샷

추가내용

  • develop, sprint 브랜치를 향하고 있습니다
  • production 브랜치를 향하고 있습니다

@kongwoojin kongwoojin self-assigned this Jan 28, 2026
@kongwoojin kongwoojin requested a review from a team as a code owner January 28, 2026 17:01
Copy link
Collaborator

@KYM-P KYM-P left a comment

Choose a reason for hiding this comment

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

GOOD

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(cacheMetadata: CacheMetadataEntity)

@Query("SELECT updated_time from ${DBConstant.CACHE_METADATA} where cacheKey = :cacheKey LIMIT 1")
Copy link
Collaborator

Choose a reason for hiding this comment

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

FROM, WHERE 같은 sql 문은 대문자로 적는게 좋아보입니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

수정했습니다

return Room.databaseBuilder(
context,
AppDatabase::class.java,
"koin_database"
Copy link
Collaborator

Choose a reason for hiding this comment

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

이것도 constant 로 관리하는건 어떨까요
수정 가능성이 매우 낮긴 하지만요

Copy link
Member Author

Choose a reason for hiding this comment

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

이거는 수정 가능성이 제로라 괜찮을 것 같습니다.

val cachedTime = cacheLocalDataSource.getCachedTime(DBConstant.STORE_CATEGORIES)
val now = System.currentTimeMillis()

val cacheShouldExpire = cachedTime == null || (now - cachedTime) > 7 * 24 * 60 * 60 * 1000L
Copy link
Collaborator

Choose a reason for hiding this comment

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

kotlin 에 7.days.inWholeMilliseconds 같은 코드나
java 의 TimeUnit.DAYS.toMillis(7) 같은 코드로 7일을 Milli 단위로 변환할 수 있다고 하네요.

Copy link
Member Author

Choose a reason for hiding this comment

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

수정했습니다

@kongwoojin kongwoojin requested a review from KYM-P January 29, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants