This commit is contained in:
张良(004796)
2024-05-10 16:42:32 +08:00
parent 0308919d04
commit ae0143d7bc
3 changed files with 5 additions and 3 deletions

View File

@@ -28,10 +28,11 @@ public class DynamicTotalCache {
return String.format(RedisHttpConstant.DYNAMIC_TOTAL_CACHE_REDIS,now,userId);
}
public void add(Long userId){
public Long add(Long userId){
String key = getKey(userId);
redisTemplate.opsForValue().increment(key);
Long increment = redisTemplate.opsForValue().increment(key);
redisTemplate.expire(key,1, TimeUnit.DAYS);
return increment;
}
public int get(Long userId){

View File

@@ -160,6 +160,7 @@ public class DynamicServiceImpl extends ServiceImpl<DynamicMapper, Dynamic> impl
dynamicImages.add(po);
}
dynamicImagesService.saveBatch(dynamicImages);
dynamicTotalCache.add(dynamic.getUserId());
}
}