逻辑调整

This commit is contained in:
2025-02-12 09:32:45 +08:00
parent 958dc05836
commit 255ea42f81
13 changed files with 48 additions and 53 deletions

View File

@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Component
@ -33,7 +34,7 @@ public class FaceRepository {
}
FaceEntity face = faceMapper.get(id);
if (face != null) {
redisTemplate.opsForValue().set(String.format(FACE_CACHE_KEY, id), JSONObject.toJSONString(face));
redisTemplate.opsForValue().set(String.format(FACE_CACHE_KEY, id), JSONObject.toJSONString(face), 60 * 60 * 24L, TimeUnit.SECONDS);
}
return face;
}

View File

@ -8,6 +8,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
@Component
public class VideoTaskRepository {
@Autowired
@ -23,7 +25,7 @@ public class VideoTaskRepository {
} else {
TaskEntity task = taskMapper.get(taskId);
if (task != null && 1 == task.getStatus()) {
redisTemplate.opsForValue().set(String.format(TASK_CACHE_KEY, taskId), JSONObject.toJSONString(task));
redisTemplate.opsForValue().set(String.format(TASK_CACHE_KEY, taskId), JSONObject.toJSONString(task), 60 * 60 * 24L, TimeUnit.SECONDS);
}
return task;
}