여러대의 Redis와 Valkey에 연결할 수 있도록 환경설정
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package kr.co.vividnext.sodalive.live.roulette
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier
|
||||
import org.springframework.data.redis.core.StringRedisTemplate
|
||||
import org.springframework.stereotype.Service
|
||||
|
||||
@Service
|
||||
class RedisIdGenerator(private val stringRedisTemplate: StringRedisTemplate) {
|
||||
class RedisIdGenerator(
|
||||
@Qualifier("redisStringRedisTemplate") private val stringRedisTemplate: StringRedisTemplate
|
||||
) {
|
||||
fun generateId(key: String): Long {
|
||||
return stringRedisTemplate.opsForValue().increment(key, 1) ?: 1L
|
||||
}
|
||||
|
Reference in New Issue
Block a user