이전 글에서 Redis Connection 과 Configuration 을 진행하였다면 다음으로는 Redis 실제로 사용하는 코드를 작성해볼까 합니다. 이번에는 서버의 헬스 체크를 하는 모듈을 작성해보았어요. @Component public class RedisComponent { @Resource(name = "redisTemplate") private ValueOperations valueOperations; private String checkedSuffix = "-checked"; public boolean isServerDown(String serverName) { final String value = valueOperations.get(serverName); if(value == null) {..
이전 글에서 캐시에 대해 기본적으로 작성을 하였으니 이번에는 캐시 메모리를 사용하는 데이터베이스 중에 하나인 레디스에 대해 간략하게 구성하는 방법을 알려드리고자 합니다. 기본적으로 AutoConfiguration 이 가능하지만 사용자의 설정에 맞게 설정을 할 수도 있습니다. 환경 Spring Boot 2.5.0 JDK 11 Java 11 build.gradle 에 아래와 같이 의존성을 추가해줍니다. implementation 'org.springframework.boot:spring-boot-starter-data-redis' 그리고 추가로 저같은 경우 다른 *.properties 파일을 사용했기 때문에 아래와 같은 의존성 하나를 더 추가해주었습니다. implementation 'org.springfra..