微信小程序缓存过期时间问题

setCache(){
    if(this.judgeTime()){ //判断缓存是否过期,过期就重新添加一个
    wx.setStorageSync('oldTime',this.oldTime());
    }
}
judgeTime(){ //判断缓存是否过期
      let nowTime = Date.now();
      let oldTime = wx.getStorageSync('oldTime');
      if(oldTime && nowTime < oldTime){
       return false;
      }
      return true;
    }
 oldTime(){ //返回以现在为准的3天后的时间
      return Date.now() + 259200000; //毫秒(72小时)
    }
    this.setCache();

原文地址:https://blog.csdn.net/frank_hehe/article/details/106471555?utm_medium=distribute.pc_relevant.none-task-blog-OPENSEARCH-2.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-2.control。如有侵权联系删除