String countKey = MessageFormat.format(CREATE_COMMENT_TOKEN_KEY,userId,sourceId,content,type,commentType,commentId,source);
Long countValue = jedis.incrBy(countKey, 1L);
if (countValue > 1) {
throw new ServiceException(Code.FAIL, "不要重复提交哦");
}
if (countValue == 1) {
jedis.expire(countKey, 3);
}
网友评论