yujian
2020-01-18 f4a0f2acc63d7785eab108419a4e16f5f688cb95
fanli/src/main/java/com/yeshi/fanli/util/cache/TaoBaoGoodsCacheUtil.java
@@ -6,6 +6,7 @@
import com.google.gson.Gson;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.util.RedisKeyEnum;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
@@ -22,7 +23,7 @@
   public void saveCommonTaoBaoGoodsInfo(TaoBaoGoodsBrief goods) {
      if (goods == null || goods.getAuctionId() == null)
         return;
      String key = "taobao-goods-common-" + goods.getAuctionId();
      String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsCommon, goods.getAuctionId() + "");
      // 保存20分钟
      redisManager.cacheCommonString(key, new Gson().toJson(goods), 60 * 20);
   }
@@ -34,7 +35,7 @@
    * @return
    */
   public TaoBaoGoodsBrief getCommonTaoBaoGoodsInfo(long auctionId) {
      String key = "taobao-goods-common-" + auctionId;
      String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoGoodsCommon, auctionId + "");
      String value = redisManager.getCommonString(key);
      if (!StringUtil.isNullOrEmpty(value)) {
         return new Gson().fromJson(value, TaoBaoGoodsBrief.class);
@@ -49,7 +50,7 @@
    * @return
    */
   public boolean canAddToUpdateQueue(Long auctionId) {
      String key = "tb-u-q-" + auctionId;
      String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoQueue, auctionId + "");
      String value = redisManager.getCommonString(key);
      if (StringUtil.isNullOrEmpty(value))
         return true;
@@ -63,7 +64,7 @@
    * @param auctionId
    */
   public void addAddToQueueHistory(Long auctionId) {
      String key = "tb-u-q-" + auctionId;
      String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoQueue, auctionId + "");
      redisManager.cacheCommonString(key, "1", 60 * 60 * 2);// 有效期2个小时
   }
@@ -74,7 +75,7 @@
    * @return
    */
   public boolean needUpdate(Long actionId) {
      String key = "tb-u-" + actionId;
      String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUpdate, actionId + "");
      String value = redisManager.getCommonString(key);
      if (StringUtil.isNullOrEmpty(value))
         return true;
@@ -89,7 +90,7 @@
    * @return
    */
   public void addUpdateHistory(Long actionId) {
      String key = "tb-u-" + actionId;
      String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.taobaoUpdate, actionId + "");
      redisManager.cacheCommonString(key, "1", 60 * 60 * 1);// 有效期1个小时
   }