Skip to content

Commit

Permalink
refactor: 캐시 사이즈 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed Jul 23, 2024
1 parent 7007a35 commit 41b540b
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,36 @@ class LocalCacheConfig {
)
val cacheManager = EhcacheCachingProvider().cacheManager

val cacheConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(
val cache10ConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(
Any::class.java,
Any::class.java,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap(50, EntryUnit.ENTRIES)
.heap(10, EntryUnit.ENTRIES)
)
.withService(cacheEventListenerConfigurationConfig)
.build()

val cache5ConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(
Any::class.java,
Any::class.java,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.heap(5, EntryUnit.ENTRIES)
)
.withService(cacheEventListenerConfigurationConfig)
.build()

val selectArticleRecordCacheConfig: javax.cache.configuration.Configuration<Any, Any> =
Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfigurationBuilder)
Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder)
val selectWorkBookRecordCacheConfig: javax.cache.configuration.Configuration<Any, Any> =
Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfigurationBuilder)
val selectWritersCacheConfig: javax.cache.configuration.Configuration<Any, Any> =
Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfigurationBuilder)
Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder)

val selectWriterCacheConfig: javax.cache.configuration.Configuration<Any, Any> =
Eh107Configuration.fromEhcacheCacheConfiguration(cache5ConfigurationBuilder)

runCatching {
cacheManager.createCache(SELECT_ARTICLE_RECORD_CACHE, selectArticleRecordCacheConfig)
cacheManager.createCache(SELECT_WORKBOOK_RECORD_CACHE, selectWorkBookRecordCacheConfig)
cacheManager.createCache(SELECT_WRITER_CACHE, selectWritersCacheConfig)
cacheManager.createCache(SELECT_WRITER_CACHE, selectWriterCacheConfig)
}.onFailure {
log.error(it) { "Failed to create cache" }
}
Expand Down

0 comments on commit 41b540b

Please sign in to comment.