Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamstar-enterprises authored Sep 7, 2024
1 parent 2db9692 commit 3b036b4
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory
import org.springframework.data.redis.connection.RedisConnectionFactory
import org.springframework.data.redis.connection.RedisPassword
import org.springframework.data.redis.connection.RedisStandaloneConfiguration
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory
Expand Down Expand Up @@ -46,6 +47,7 @@ internal class RedisConnectionFactoryConfig(
private val springDataProperties: SpringDataProperties
) {

// reactive RedisConnectionFactory for key expiration event handling
@Bean
@Primary
fun reactiveRedisConnectionFactory(): ReactiveRedisConnectionFactory {
Expand Down Expand Up @@ -164,6 +166,18 @@ internal class RedisConnectionFactoryConfig(
}
}

// non-reactive RedisConnectionFactory for key expiration event handling
@Bean
fun redisConnectionFactory(): RedisConnectionFactory {
val config = RedisStandaloneConfiguration()
config.hostName = springDataProperties.redis.host
config.port = springDataProperties.redis.port
config.setPassword(RedisPassword.of(springDataProperties.redis.password))

// create Lettuce connection factory
return LettuceConnectionFactory(config)
}

}


Expand Down

0 comments on commit 3b036b4

Please sign in to comment.