记得上下班打卡 | git大法好,push需谨慎

Commit eae37911 authored by 张国柄's avatar 张国柄

+log;

parent 1a30a095
...@@ -84,8 +84,12 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -84,8 +84,12 @@ public class GoblinCouponImpl implements GoblinCouponService {
userCouponVoList.add(GoblinUserCouponVo.getNew().copy(receiveUserCouponBasicVo)); userCouponVoList.add(GoblinUserCouponVo.getNew().copy(receiveUserCouponBasicVo));
long s = System.nanoTime();
goblinMongoUtils.insertUserCouponVo(receiveUserCouponBasicVo); goblinMongoUtils.insertUserCouponVo(receiveUserCouponBasicVo);
log.info("MDB.I耗时:{}ms", (System.nanoTime() - s) / 1000000);
s = System.nanoTime();
goblinRedisUtils.setUserCouponVos(uid, userCouponVoList); goblinRedisUtils.setUserCouponVos(uid, userCouponVoList);
log.info("RDS.S耗时:{}ms", (System.nanoTime() - s) / 1000000);
LinkedList<Object[]> initUserCouponObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initUserCouponObjs = CollectionUtil.linkedListObjectArr();
initUserCouponObjs.add(new Object[]{ initUserCouponObjs.add(new Object[]{
......
...@@ -14,6 +14,7 @@ import com.liquidnet.service.goblin.dto.vo.*; ...@@ -14,6 +14,7 @@ import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner; import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord; import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.liquidnet.service.goblin.entity.GoblinFrontNavigation; import com.liquidnet.service.goblin.entity.GoblinFrontNavigation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -26,6 +27,7 @@ import java.util.stream.Collectors; ...@@ -26,6 +27,7 @@ import java.util.stream.Collectors;
import static com.liquidnet.service.goblin.constant.GoblinRedisConst.REDIS_GOBLIN_TEMP_COUPON_MARKET; import static com.liquidnet.service.goblin.constant.GoblinRedisConst.REDIS_GOBLIN_TEMP_COUPON_MARKET;
@Slf4j
@Component @Component
public class GoblinRedisUtils { public class GoblinRedisUtils {
@Autowired @Autowired
...@@ -1259,15 +1261,19 @@ public class GoblinRedisUtils { ...@@ -1259,15 +1261,19 @@ public class GoblinRedisUtils {
public List<GoblinUserCouponVo> getUserCouponVos(String uid) { public List<GoblinUserCouponVo> getUserCouponVos(String uid) {
String rk = GoblinRedisConst.USER_COUPON.concat(uid); String rk = GoblinRedisConst.USER_COUPON.concat(uid);
long s = System.nanoTime();
String valStr = (String) redisUtil.get(rk); String valStr = (String) redisUtil.get(rk);
log.info("RDS.G耗时:{}ms", (System.nanoTime() - s) / 1000000);
List<GoblinUserCouponVo> vos = null; List<GoblinUserCouponVo> vos = null;
if (StringUtils.isEmpty(valStr)) { if (StringUtils.isEmpty(valStr)) {
// if (!CollectionUtils.isEmpty(vos = goblinMongoUtils.getUserCouponVos(uid))) { // if (!CollectionUtils.isEmpty(vos = goblinMongoUtils.getUserCouponVos(uid))) {
// redisUtil.set(rk, JsonUtils.toJson(vos)); // redisUtil.set(rk, JsonUtils.toJson(vos));
// } // }
} else { } else {
s = System.nanoTime();
vos = JsonUtils.fromJson(valStr, new TypeReference<List<GoblinUserCouponVo>>() { vos = JsonUtils.fromJson(valStr, new TypeReference<List<GoblinUserCouponVo>>() {
}); });
log.info("JSO.P耗时:{}ms", (System.nanoTime() - s) / 1000000);
} }
return vos; return vos;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment