From 41b540bbfc68cf2f04023f6b5c56a533deaca5ab Mon Sep 17 00:00:00 2001 From: belljun3395 <195850@jnu.ac.kr> Date: Wed, 24 Jul 2024 00:35:58 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=BA=90=EC=8B=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9D=B4=EC=A6=88=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../few/api/repo/config/LocalCacheConfig.kt | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt b/api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt index 4e0a2842b..30551d249 100644 --- a/api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt +++ b/api-repo/src/main/kotlin/com/few/api/repo/config/LocalCacheConfig.kt @@ -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 = - Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfigurationBuilder) + Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder) val selectWorkBookRecordCacheConfig: javax.cache.configuration.Configuration = - Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfigurationBuilder) - val selectWritersCacheConfig: javax.cache.configuration.Configuration = - Eh107Configuration.fromEhcacheCacheConfiguration(cacheConfigurationBuilder) + Eh107Configuration.fromEhcacheCacheConfiguration(cache10ConfigurationBuilder) + + val selectWriterCacheConfig: javax.cache.configuration.Configuration = + 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" } }