대머리개발자

[레디스] ERR unknown command `LPOS` 본문

개발이야기/예외

[레디스] ERR unknown command `LPOS`

대머리개발자 2023. 10. 13. 15:13
728x90

 

우리 네이버 형님들.... 5.0.14 따쉬. ㅠㅠ

 

하악하악....

 

기존 리스트로 관리하고 있는 "키 배열"에서 사용을 했으면 새로운 키로 대체 해주는 코드이다.

 

    return reactiveRedisOperations.opsForList().indexOf(key, oldValue)
                .flatMap( index -> reactiveRedisOperations.opsForList().set(key, index, newValue)
                        .then( reactiveRedisOperations.expire(key, Duration.ofSeconds(seconds))))

range로 순회해야지.. ㅠ index() 적용 하면 튜플로 나온다... (0, key) (1, key)....

다행이다...

return reactiveRedisOperations.opsForList().range(key, 0, endpoint)
                .index()
                .filter( tuple_ ->  tuple_.getT2().equals( oldValue))
                .flatMap( hit_tuple -> reactiveRedisOperations.opsForList().set(key, hit_tuple.getT1(), newValue)
                                        .then(reactiveRedisOperations.expire(key, Duration.ofSeconds(seconds)))
                ).then(Mono.just(true));
728x90