We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Component class DistributedLock( private val reactiveRedisTemplate: ReactiveRedisTemplate<String, String>, @Value("\${redis.lock.timeout}") private val timeout: Long ) { fun acquireLock(key: String): Mono<Boolean> { // Redis의 SETNX 명령어를 사용하여 락을 획득합니다. (원자성 보장) // key : 저장할 키, "" : 저장 value, timeout : TTL return reactiveRedisTemplate.opsForValue().setIfAbsent(key, "", Duration.ofMillis(timeout)) } fun releaseLock(key: String): Mono<Boolean> { // Redis의 DEL 명령어를 사용하여 락을 해제합니다. (원자성 보장) return reactiveRedisTemplate.delete(key) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
개요
할일
source
The text was updated successfully, but these errors were encountered: