content: package shop.kkeujeok.kkeujeokbackend.global.config;
  
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.data.redis.connection.RedisConnectionFactory;
  import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
  import org.springframework.data.redis.core.RedisTemplate;
  import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
  import org.springframework.data.redis.serializer.StringRedisSerializer;
  
  @Configuration
  @EnableRedisRepositories
  public class RedisConfig {
      @Value("${spring.data.redis.host}")
      private String host;
  
      @Value("${spring.data.redis.port}")
      private int port;
  
      @Bean
      public RedisConnectionFactory redisConnectionFactory() {
          return new LettuceConnectionFactory(host, port);
      }
  
      @Bean
      public RedisTemplate<String, String> redisTemplate() {
          RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
          redisTemplate.setKeySerializer(new StringRedisSerializer());
          redisTemplate.setValueSerializer(new StringRedisSerializer());
          redisTemplate.setHashKeySerializer(new StringRedisSerializer());
          redisTemplate.setHashValueSerializer(new StringRedisSerializer());
          redisTemplate.setConnectionFactory(redisConnectionFactory());
          return redisTemplate;
      }
  
  }