You've already forked FrameTour-BE
feat(puzzle): 添加拼图素材版本缓存优化重复生成
- 新增 puzzleSourceVersionCache 缓存用于记录拼图素材版本 - 实现 isPuzzleSourceChanged 方法判断素材是否变化 - 添加 markPuzzleSourceVersion 方法标记当前素材版本 - 实现 invalidatePuzzleSourceVersion 方法清除指定人脸缓存 - 在人脸关系变更时自动清除相关拼图素材版本缓存 - 重构 AppPuzzleController 使用 PuzzleRepository 替代直接访问 Mapper - 添加生成记录缓存机制,包括按人脸ID和记录ID的缓存 - 实现素材版本缓存命中时复用历史记录功能 - 优化重复内容检测逻辑,添加缓存标记机制 - 在各种生成流程中添加缓存清除逻辑确保数据一致性
This commit is contained in:
@@ -59,6 +59,8 @@ public class SourceRepository {
|
||||
@Autowired
|
||||
private MemberRelationRepository memberRelationRepository;
|
||||
@Autowired
|
||||
private com.ycwl.basic.biz.FaceStatusManager faceStatusManager;
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
|
||||
public void addSource(SourceEntity source) {
|
||||
@@ -81,6 +83,7 @@ public class SourceRepository {
|
||||
memberSource.setIsBuy(1);
|
||||
sourceMapper.updateRelation(memberSource);
|
||||
memberRelationRepository.clearSCacheByFace(faceId);
|
||||
faceStatusManager.invalidatePuzzleSourceVersion(faceId);
|
||||
|
||||
// 如果需要图像处理,对该faceId下的所有type=3的照片进行处理
|
||||
if (needsImageProcessing) {
|
||||
@@ -229,6 +232,7 @@ public class SourceRepository {
|
||||
memberSource.setIsBuy(0);
|
||||
sourceMapper.updateRelation(memberSource);
|
||||
memberRelationRepository.clearSCacheByFace(faceId);
|
||||
faceStatusManager.invalidatePuzzleSourceVersion(faceId);
|
||||
}
|
||||
|
||||
public SourceEntity getSource(Long id) {
|
||||
|
||||
Reference in New Issue
Block a user