def ClearExpTimeList(self,expireTime): nowTime = TimeUtils.GetNowUnixTime() for k,v in self.items(): creatTime=TimeUtils.String2UnixTime(v.create_time,"%Y-%m-%d %H:%M:%S") if nowTime - creatTime > expireTime: self.pop(k) continue
history = LoadHistory() print "history length:", len(history) newDoc = LoadNewDoc() print "newDoc length:", len(newDoc) res = {} nowTime = tu.GetNowUnixTime() for k, v in newDoc.items(): if k in hotout: continue if k in hotin: continue if k in history: continue cTime = tu.String2UnixTime(v.create_time, "%Y-%m-%d %H:%M:%S") if nowTime - cTime > 24 * 60 * 60: continue res[k] = v print "res length:", len(res) SaveNewDoc(res)