refactor: migrate Redis cache implementation to Valkey with enhanced configurability
Replaced Redis with Valkey as the caching backend across infrastructure and application modules. Updated configurations, templates, and health checks to reflect Valkey-specific parameters. Improved compatibility with enhanced configurability, including max memory and memory eviction policy settings.
This commit is contained in:
@@ -29,7 +29,7 @@ dependencies {
|
||||
// === Redis & Spring Dependencies ===
|
||||
// OPTIMIERUNG: Wiederverwendung des `redis-cache`-Bundles, da es die
|
||||
// gleichen Technologien (Spring Data Redis, Lettuce, Jackson) verwendet
|
||||
implementation(libs.bundles.redis.cache)
|
||||
implementation(libs.bundles.valkey.cache)
|
||||
// Stellt Jakarta Annotations bereit (z. B. @PostConstruct), die von Spring verwendet werden
|
||||
implementation(libs.jakarta.annotation.api)
|
||||
// Für Kotlin-spezifische Coroutines-Integration mit Spring
|
||||
@@ -44,7 +44,7 @@ dependencies {
|
||||
testImplementation(libs.reactor.test)
|
||||
// Für Integration Tests mit beiden Redis-Modulen
|
||||
testImplementation(projects.backend.infrastructure.cache.cacheApi)
|
||||
testImplementation(projects.backend.infrastructure.cache.redisCache)
|
||||
testImplementation(projects.backend.infrastructure.cache.valkeyCache)
|
||||
}
|
||||
|
||||
// === Task Configuration ===
|
||||
|
||||
+9
-9
@@ -4,9 +4,9 @@ import at.mocode.core.domain.event.DomainEvent
|
||||
import at.mocode.core.domain.model.*
|
||||
import at.mocode.infrastructure.cache.api.CacheConfiguration
|
||||
import at.mocode.infrastructure.cache.api.DistributedCache
|
||||
import at.mocode.infrastructure.cache.redis.JacksonCacheSerializer
|
||||
import at.mocode.infrastructure.cache.redis.RedisConfiguration
|
||||
import at.mocode.infrastructure.cache.redis.RedisDistributedCache
|
||||
import at.mocode.infrastructure.cache.valkey.JacksonCacheSerializer
|
||||
import at.mocode.infrastructure.cache.valkey.ValkeyConfiguration
|
||||
import at.mocode.infrastructure.cache.valkey.ValkeyDistributedCache
|
||||
import at.mocode.infrastructure.eventstore.api.EventStore
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
@@ -90,17 +90,17 @@ class RedisCacheAndEventStoreIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
@Import(
|
||||
RedisConfiguration::class,
|
||||
ValkeyConfiguration::class,
|
||||
RedisEventStoreConfiguration::class
|
||||
)
|
||||
class TestConfig {
|
||||
@Bean
|
||||
fun distributedCache(
|
||||
@Qualifier("redisTemplate") redisTemplate: RedisTemplate<String, ByteArray>,
|
||||
cacheConfiguration: CacheConfiguration
|
||||
@Qualifier("valkeyTemplate") redisTemplate: RedisTemplate<String, ByteArray>,
|
||||
cacheConfiguration: CacheConfiguration
|
||||
): DistributedCache {
|
||||
return RedisDistributedCache(
|
||||
redisTemplate = redisTemplate,
|
||||
return ValkeyDistributedCache(
|
||||
valkeyTemplate = redisTemplate,
|
||||
serializer = JacksonCacheSerializer(),
|
||||
config = cacheConfiguration
|
||||
)
|
||||
@@ -115,7 +115,7 @@ class RedisCacheAndEventStoreIntegrationTest {
|
||||
|
||||
// Verify separate ConnectionFactories
|
||||
@Autowired
|
||||
@Qualifier("redisConnectionFactory")
|
||||
@Qualifier("valkeyConnectionFactory")
|
||||
private lateinit var cacheConnectionFactory: RedisConnectionFactory
|
||||
|
||||
@Autowired
|
||||
|
||||
Reference in New Issue
Block a user