레디스 트랜잭션
However, RedisTemplate is not guaranteed to run all the operations in the transaction with the same connection.
Read-only commands, such as KEYS, are piped to a fresh (non-thread-bound) RedisConnection to allow reads. Write commands are queued by RedisTemplate and applied upon commit.
레디스는 multi, exec, and discard commands로 트랜잭션을 제공합니다.
위의 명령은 스프링에서 RedisTemplate을 이용해 실행할 수 있습니다.
하지만 RedisTemplate이 한 트랜잭션에 있는 모든 작업을 같은 커넥션으로 보장하지 않습니다.
레디스는 트랜잭션 내에 같은 커넥션에서 수행됨을 보장하지 않고 읽기전용 명령어들은 새로운 커넥션에서 수행되며 쓰기전용 명령어들만 큐에 담습니다.
만약 커넥션 하나로 모든 작업을 수행하고 싶다면 Spring Data Redis 에서 지원하는 SessionCallback이나 @Transactional 을 사용하면 됩니다.
두 방법은 각각 장단점이 있으니 찾아보시길 바랍니다.
https://docs.spring.io/spring-data/redis/docs/2.5.2/reference/html/#tx
Spring Data Redis
Some commands (such as SINTER and SUNION) can only be processed on the server side when all involved keys map to the same slot. Otherwise, computation has to be done on client side. Therefore, it is useful to pin keyspaces to a single slot, which lets make
docs.spring.io
https://velog.io/@cmsskkk/redis-transaction-spring-and-lua-pipeline
Redis Transaction, Lua script, Pipeline 개념 과 SpringDataRedis에서의 사용법
Spring에서 Redis를 연동하고 활용하는 연습을 진행 중 입니다.Spirng boot에서 Redis를 연동하여 사용하는 방법과 원리에 대해서 이해해보고자 하는 글입니다.Redis는 local 환경의 Docker 컨테이너를 활용
velog.io
https://velog.io/@sunwook317/spring-data-redis%EC%99%80-%ED%8A%B8%EB%9E%9C%EC%9E%AD%EC%85%98
spring data redis와 트랜잭션
레디스 트랜잭션은 다른 DB와는 다르게 rollback을 지원하지않는다. 단지 명령어들을 하나의 큐에 넣고 큐에 쌓인 명령어들이 실행되는 동안 다른 명령어가 실행되지않음을 보장할 뿐이다. 따라서
velog.io
레디스 데이터 영구 저장
[REDIS] 📚 캐시 데이터 영구 저장하는 방법 (RDB / AOF)
Redis 데이터의 영속성 (Redis Persistence) Redis는 In-memory DB 임에도 불구하고, 메모리 데이터를 disk에 저장할 수 있는 특징이 있다. 그래서 서버가 꺼진 후 restart되더라도, disk에 저장해놓은 데이타를
inpa.tistory.com
레디스 동시성 이슈
https://dev-monkey-dugi.tistory.com/151
Redis 동시성 이슈 개선하기
Redis에서 조회수 증가 동시성 이슈 조회수를 Redis에 캐싱하고 나중에 RDB로 write back해야하는 일이 있었다. Redis에서 해야하는 일은 게시물이 조회되면 → 해당 게시물의 id를 key로하여 조회수를 저
dev-monkey-dugi.tistory.com