去掉redis

This commit is contained in:
zren25
2025-03-27 16:36:03 +08:00
parent 755a18f43e
commit 6bfce4167a
3 changed files with 0 additions and 35 deletions

View File

@@ -226,10 +226,6 @@
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@@ -1,18 +0,0 @@
package com.volvo.ai.analytic.center.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
@Configuration
public class RedisConfig {
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
return template;
}
}

View File

@@ -34,7 +34,6 @@ import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.messaging.support.MessageBuilder; import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -45,7 +44,6 @@ import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -79,9 +77,6 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
@Autowired @Autowired
private AiAnalysisRequestLogsService aiAnalysisRequestLogsService; private AiAnalysisRequestLogsService aiAnalysisRequestLogsService;
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Override @Override
@Transactional @Transactional
public void saveTelephoneCorpus(TmTelephoneCorpus tmTelephoneCorpus) { public void saveTelephoneCorpus(TmTelephoneCorpus tmTelephoneCorpus) {
@@ -181,12 +176,6 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
public String getCarModelList(){ public String getCarModelList(){
try { try {
// 从 Redis 中获取缓存数据
String cachedModelNames = (String) redisTemplate.opsForValue().get(ConstantStr.CARMODELLIST_CACHEKEY);
if (cachedModelNames != null) {
log.info("从缓存中获取车型列表: {}", cachedModelNames);
return cachedModelNames;
}
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
CarModelReqDTO carModelReqDTO = new CarModelReqDTO(); CarModelReqDTO carModelReqDTO = new CarModelReqDTO();
carModelReqDTO.setOnSale(10041001); carModelReqDTO.setOnSale(10041001);
@@ -201,8 +190,6 @@ public class TmTelephoneCorpusServiceImpl extends ServiceImpl<TmTelephoneCorpusM
.collect(Collectors.joining(", ")); // 用逗号和空格拼接 .collect(Collectors.joining(", ")); // 用逗号和空格拼接
log.info("拼接后的车型名称: {}", modelNames); log.info("拼接后的车型名称: {}", modelNames);
// 将结果存入 Redis设置过期时间为 1 小时
redisTemplate.opsForValue().set(ConstantStr.CARMODELLIST_CACHEKEY, modelNames, 5, TimeUnit.DAYS);
return modelNames; return modelNames;
} }