-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Feat/#238] 데이터 베이스 케시 설정 #246
Conversation
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.
고생하셨습니다! 추가적으로 캐시 라이브러리를 호출하는 MemberCacheManager 코드에서 예외가 발생될 부분이 있는지 검토 부탁드립니다. 캐시 접근에 대한 예외가 API 실패로 연결되는건 바람직하지 않을것 같아서요
Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder) | ||
val selectWorkBookRecordCacheConfig: javax.cache.configuration.Configuration<Any, Any> = | ||
Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder) |
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.
캐시 컨피그 객체는 공유해도 잘 동작하나요?
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.
네 런타임에 컨피그 객체를 수정하는 것이 없어 문제 없을 것 같습니다.
.where(Member.MEMBER.ID.`in`(notCachedId)) | ||
.and(Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code)) |
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.
.where(Member.MEMBER.ID.
in(notCachedId))
에서 충분히 작가가 필터링 될 수 있기 때문에 .and(Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code))
는 생략해도 될 것 같아요. 안그래도 TYPE_CD에 인덱싱도 없을거 같구요
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.
실행계획을 보면 Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code) 가 영향이 없어 보이는데 맞을까요..?
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.
row가 적어서 실행계획이 크게 의미가 없긴 한데, 만약 로우가 엄청 많아질 때를 가정하면 TYPE_CD에 인덱스가 없어 필터 조건에 넣을지 고민해봐야 할거 같아요. 지금은 일단 이상없을거고 나중에 실행계획 보고 생각해보시죠
val cachedId = cachedValues.map { it.writerId } | ||
val notCachedId = query.writerIds.filter { it !in cachedId } |
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.
별건 아니지만 cachedId, notCachedId 변수는 복수형으로 바꾸는게 좋을거 같습니다. 딱 봤을때 컬렉션 타입인지 알 수 있어서요
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.
520898a 에서 수정하였습니다.
private val cacheManager: CacheManager, | ||
) { | ||
|
||
private var selectWriterCache: Cache<Any, Any> = cacheManager.getCache(SELECT_WRITER_CACHE)?.nativeCache as Cache<Any, Any> |
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.
호오옥시나 런타임 중에 cacheManager.getCache(SELECT_WRITER_CACHE)?.nativeCache
레퍼런스가 바뀌진 않겠죠?
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.
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.
오.. 굳잡
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.
리뷰 감사합니다!
Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder) | ||
val selectWorkBookRecordCacheConfig: javax.cache.configuration.Configuration<Any, Any> = | ||
Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder) |
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.
네 런타임에 컨피그 객체를 수정하는 것이 없어 문제 없을 것 같습니다.
private val cacheManager: CacheManager, | ||
) { | ||
|
||
private var selectWriterCache: Cache<Any, Any> = cacheManager.getCache(SELECT_WRITER_CACHE)?.nativeCache as Cache<Any, Any> |
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 cachedId = cachedValues.map { it.writerId } | ||
val notCachedId = query.writerIds.filter { it !in cachedId } |
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.
520898a 에서 수정하였습니다.
.where(Member.MEMBER.ID.`in`(notCachedId)) | ||
.and(Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code)) |
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.
실행계획을 보면 Member.MEMBER.TYPE_CD.eq(MemberType.WRITER.code) 가 영향이 없어 보이는데 맞을까요..?
dd1d3ad
to
4d5a4bd
Compare
d38780d
to
520898a
Compare
🎫 연관 이슈
resolved: #238
💁♂️ PR 내용
🙏 작업
🙈 PR 참고 사항
📸 스크린샷
selectWorkBook 캐시 확인
엔트리 사이즈 3으로 설정후 아이디 1 -> 2 -> 3 -> 4 -> 4 조회 결과
selectWriter 메서드, selectWriters 메서드 캐시 확인
아티클 조회시 selectWriter 수행됨
워크북 조회시 selectWriters 수행됨
워크북 1에 포함된 아티클 조회
selectWriter에서 캐시 저장
워크북 1 조회
selectWriters에서 캐시에 저장된 값 사용
🤖 테스트 체크리스트