1. 의존성 추가
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
2. Redis연결 설정 구성
2-1. application.properties에 아래와 같이
spring.redis.host=localhost
spring.redis.port=6379
2-2. @Configuration클래스 구성

RedisTemplate 스프링빈이 Redis에서 저장,조회를 수행하게됨
3. 데이터 저장,조회 구현
redisTemplate.opsForValue().set(key, value);
(String)redisTemplate.opsForValue().get(key);
RedisTemplate > ValueOperations > set(), get()
4. 테스트
테스트 결과 성공정
'Spring > DB연동' 카테고리의 다른 글
| JPA 01 (0) | 2024.07.02 |
|---|---|
| SpringBoot에서 Redis로 Cache기능 구현하기 (0) | 2024.06.25 |
| [JPA] @Entity 에서 컬럼이름 스네이크케이스로 자동변환됨 (0) | 2024.05.23 |
| JPA에서 update ( PersistenceContext ) (0) | 2024.05.23 |
| Querydsl (0) | 2024.05.09 |