-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature][Koin Project] 상점 카테고리 캐싱 로직 구현 #1250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
KYM-P
left a comment
There was a problem hiding this 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FROM, WHERE 같은 sql 문은 대문자로 적는게 좋아보입니다.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이것도 constant 로 관리하는건 어떨까요
수정 가능성이 매우 낮긴 하지만요
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 단위로 변환할 수 있다고 하네요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다
PR 개요
PR 체크리스트
작업사항
작업사항의 상세한 설명
CacheMetadataDao를 추가했습니다.cacheKey를 활용해서 캐싱된 시간을 저장하시면 됩니다.논의 사항
스크린샷
추가내용