From 52e5d50782441fe2c905896bcd27c2244d28baab Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 26 Jun 2024 20:42:47 +0100 Subject: [PATCH] oops --- .../bat/config/RedisCacheConfig.java | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 src/main/java/cc/fascinated/bat/config/RedisCacheConfig.java diff --git a/src/main/java/cc/fascinated/bat/config/RedisCacheConfig.java b/src/main/java/cc/fascinated/bat/config/RedisCacheConfig.java deleted file mode 100644 index d44af8d..0000000 --- a/src/main/java/cc/fascinated/bat/config/RedisCacheConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -package cc.fascinated.bat.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.RedisStandaloneConfiguration; -import org.springframework.data.redis.connection.jedis.JedisClientConfiguration; -import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; -import org.springframework.data.redis.core.RedisTemplate; - -import java.time.Duration; - -/** - * @author Fascinated (fascinated7) - */ -@Configuration -public class RedisCacheConfig { - @Value(value="${spring.redis.host}") - private String host; - - @Value(value="${spring.redis.port}") - private String port; - - @Value(value="${spring.redis.timeout}") - private String timeout; - - @Value(value="${spring.redis.database}") - private String database; - - @Bean - JedisConnectionFactory jedisConnectionFactory() { - RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration(); - redisStandaloneConfiguration.setHostName(host); - redisStandaloneConfiguration.setPort(Integer.parseInt(port)); - redisStandaloneConfiguration.setDatabase(Integer.parseInt(database)); - - JedisClientConfiguration.JedisClientConfigurationBuilder jedisClientConfiguration = JedisClientConfiguration.builder(); - jedisClientConfiguration.connectTimeout(Duration.ofSeconds(Integer.parseInt(timeout)));// connection timeout - - return new JedisConnectionFactory(redisStandaloneConfiguration, - jedisClientConfiguration.build()); - } - - @Bean - public RedisTemplate redisTemplate() { - RedisTemplate template = new RedisTemplate<>(); - template.setConnectionFactory(jedisConnectionFactory()); - return template; - } -}