This commit is contained in:
2025-01-16 18:28:04 +08:00
parent 0bba613001
commit bbcbdd2839
24 changed files with 436 additions and 111 deletions

View File

@ -39,9 +39,9 @@ public class FaceRepository {
}
public List<FaceSampleEntity> getFaceSampleList(Long faceId) {
if (redisTemplate.hasKey(String.format(FACE_SAMPLE_CACHE_KEY, faceId))) {
return JSONObject.parseArray(redisTemplate.opsForValue().get(String.format(FACE_SAMPLE_CACHE_KEY, faceId)), FaceSampleEntity.class);
}
// if (redisTemplate.hasKey(String.format(FACE_SAMPLE_CACHE_KEY, faceId))) {
// return JSONObject.parseArray(redisTemplate.opsForValue().get(String.format(FACE_SAMPLE_CACHE_KEY, faceId)), FaceSampleEntity.class);
// }
FaceEntity face = getFace(faceId);
if (face == null) {
return Collections.emptyList();
@ -50,9 +50,9 @@ public class FaceRepository {
return Collections.emptyList();
}
List<FaceSampleEntity> list = faceSampleMapper.listByIds(Arrays.stream(face.getMatchSampleIds().split(",")).map(Long::valueOf).collect(Collectors.toList()));
if (!list.isEmpty()) {
redisTemplate.opsForValue().set(String.format(FACE_SAMPLE_CACHE_KEY, faceId), JSONObject.toJSONString(list));
}
// if (!list.isEmpty()) {
// redisTemplate.opsForValue().set(String.format(FACE_SAMPLE_CACHE_KEY, faceId), JSONObject.toJSONString(list));
// }
return list;
}