-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/#239_belljun3395
- Loading branch information
Showing
13 changed files
with
320 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
api-repo/src/main/kotlin/com/few/api/repo/dao/member/MemberCacheManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.few.api.repo.dao.member | ||
|
||
import com.few.api.repo.config.LocalCacheConfig.Companion.SELECT_WRITER_CACHE | ||
import com.few.api.repo.dao.member.record.WriterRecord | ||
import org.springframework.cache.CacheManager | ||
import org.springframework.stereotype.Service | ||
import javax.cache.Cache | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
@Service | ||
class MemberCacheManager( | ||
private val cacheManager: CacheManager, | ||
) { | ||
|
||
private var selectWriterCache: Cache<Any, Any> = cacheManager.getCache(SELECT_WRITER_CACHE)?.nativeCache as Cache<Any, Any> | ||
|
||
fun getAllWriterValues(): List<WriterRecord> { | ||
val values = mutableListOf<WriterRecord>() | ||
selectWriterCache.iterator().forEach { | ||
values.add(it.value as WriterRecord) | ||
} | ||
return values | ||
} | ||
|
||
fun getAllWriterValues(keys: List<Long>): List<WriterRecord> { | ||
val values = mutableListOf<WriterRecord>() | ||
keys.forEach { | ||
selectWriterCache.get(it)?.let { value -> | ||
values.add(value as WriterRecord) | ||
} | ||
} | ||
return values | ||
} | ||
|
||
fun addSelectWorkBookCache(records: List<WriterRecord>) { | ||
records.forEach { | ||
selectWriterCache.put(it.writerId, it) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
api-repo/src/main/kotlin/com/few/api/repo/dao/workbook/WorkBookCacheManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.few.api.repo.dao.workbook | ||
|
||
import com.few.api.repo.config.LocalCacheConfig.Companion.SELECT_WORKBOOK_RECORD_CACHE | ||
import com.few.api.repo.dao.workbook.record.SelectWorkBookRecord | ||
import org.springframework.cache.CacheManager | ||
import org.springframework.stereotype.Service | ||
import javax.cache.Cache | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
@Service | ||
class WorkBookCacheManager( | ||
private val cacheManager: CacheManager, | ||
) { | ||
|
||
private var selectWorkBookCache: Cache<Any, Any> = cacheManager.getCache(SELECT_WORKBOOK_RECORD_CACHE)?.nativeCache as Cache<Any, Any> | ||
|
||
fun getAllSelectWorkBookValues(): List<SelectWorkBookRecord> { | ||
val values = mutableListOf<SelectWorkBookRecord>() | ||
selectWorkBookCache.iterator().forEach { | ||
values.add(it.value as SelectWorkBookRecord) | ||
} | ||
return values | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
api/src/main/kotlin/com/few/api/domain/article/usecase/ReadArticlesUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.few.api.domain.article.usecase | ||
|
||
import com.few.api.domain.article.usecase.dto.ReadArticlesUseCaseIn | ||
import com.few.api.domain.article.usecase.dto.ReadArticlesUseCaseOut | ||
import org.springframework.stereotype.Component | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Component | ||
class ReadArticlesUseCase { | ||
|
||
@Transactional(readOnly = true) | ||
fun execute(useCaseIn: ReadArticlesUseCaseIn): ReadArticlesUseCaseOut { | ||
return ReadArticlesUseCaseOut(emptyList()) // TODO: impl | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
api/src/main/kotlin/com/few/api/domain/article/usecase/dto/ReadArticlesUseCaseIn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.few.api.domain.article.usecase.dto | ||
|
||
data class ReadArticlesUseCaseIn( | ||
val prevArticleId: Long, | ||
) |
5 changes: 5 additions & 0 deletions
5
api/src/main/kotlin/com/few/api/domain/article/usecase/dto/ReadArticlesUseCaseOut.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.few.api.domain.article.usecase.dto | ||
|
||
data class ReadArticlesUseCaseOut( | ||
val articles: List<ReadArticleUseCaseOut>, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
api/src/main/kotlin/com/few/api/web/controller/article/response/ReadArticlesResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.few.api.web.controller.article.response | ||
|
||
data class ReadArticlesResponse( | ||
val articles: List<ReadArticleResponse>, | ||
val isLast: Boolean, | ||
) |
Oops, something went wrong.