๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Redis

(2)
์ฝ”๋“œ๋กœ ์•Œ์•„๋ณด๋Š” Spring Data Redis์˜ @Cacheable ๋™์ž‘ ์›๋ฆฌ์™€ ํŠธ๋žœ์žญ์…˜์—์„œ @CachePut/@CacheEvict ์‹คํ–‰ ์‹œ์  ๊ธ€์˜ ๋ชฉํ‘œSpring Data Redis์—์„œ @Cacheable ๋ฉ”์„œ๋“œ๋ฅผ ์‹คํ–‰ํ•˜๊ณ , ์บ์‹œ ๋ฏธ์Šค(Cache miss)๋กœ ์ธํ•ด ๋ฐ˜ํ™˜๊ฐ’์ด ์บ์‹œ์— ์ €์žฅ๋˜๋Š” ๊ณผ์ •. ๊ทธ๋ฆฌ๊ณ , @Transactional๊ณผ ํ•จ๊ป˜ @CachePut/@CacheEvict๋ฅผ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ @CachePut/@CacheEvict๊ฐ€ ์–ธ์ œ ์‹คํ–‰๋˜๋Š”์ง€๋ฅผ ๋‚ด๋ถ€ ๊ตฌํ˜„์„ ํ†ตํ•ด ์•„๋Š” ๊ฒƒ์ด ๋ชฉํ‘œ์ž…๋‹ˆ๋‹ค. ๋ณธ ๊ธ€์€ RedisCache์— ํ•œ์ •๋œ ๋‚ด์šฉ์ž„์„ ๋ฏธ๋ฆฌ ์•Œ๋ ค๋“œ๋ฆฝ๋‹ˆ๋‹ค. Spring Cache ์ถ”์ƒํ™” ๊ตฌ์กฐ Spring Cache๋Š” Cache ์ธํ„ฐํŽ˜์ด์Šค์™€ CacheManager ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ†ตํ•ด ์ถ”์ƒํ™”๋ฉ๋‹ˆ๋‹ค This abstraction is materialized by the org.springframework.cache.Cache and org.springf..
RedisTemplate ๋‚ด๋ถ€ ํƒ๊ตฌ: Spring Data Redis๋Š” Lettuce๋ฅผ ์–ด๋–ป๊ฒŒ ์ถ”์ƒํ™”ํ–ˆ๋Š”๊ฐ€? Lettuce ๊ฐ€ ๋ฌด์—‡์ธ์ง€, Spring Data Redis์˜ RedisTemplate ์€ Lettuce ๋ฅผ ์–ด๋–ป๊ฒŒ ์ถ”์ƒํ™”ํ–ˆ๋Š”์ง€ ์•Œ์•„๋ณด๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค. ๋จผ์ €, Spring Data Redis ๋Š” Lettuce์™€ Jedis ๋ผ๋Š” 2๊ฐœ์˜ ์˜คํ”ˆ ์†Œ์Šค ๋ผ์ด๋ธŒ๋Ÿฌ์™€ ํ†ตํ•ฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.Spring Data Redis integrates with Lettuce and Jedis, two popular open-source Java libraries for Redis. Lettuce์™€ Jedis๋Š” "Java์—์„œ Redis์— ์ ‘๊ทผํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›์„ ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ"์ž…๋‹ˆ๋‹ค.๊ทธ๋ ‡๋‹ค๋ฉด ๊ฐ๊ฐ ๋ฌด์—‡์ธ์ง€ Lettuce๋ถ€ํ„ฐ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.Lettuce ๋ž€?Lettuce is a scalable thread-safe Redi..