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