def _isFeedNew(self, feedItem): feedResUpdateTime = FeedResUpdateTime.get(self.feedRes.id) isFeedUpdated = feedItem.isUpdated(feedResUpdateTime) notInCache = True if not Cache.isEmpty(): notInCache = not Cache.isExist(feedItem) return isFeedUpdated and notInCache
def test_fillCache(self): self.resOper.fillCache() self.assertLessEqual(0, Cache.size())
def fillCache(self): self.getFeedResUpdateTime() for e in self.getFeeds(100): Cache.update(e)
def _writeFeeds(self, feeds, table): sql = 'insert into {} (from_feed_id, title, link, time) values ({!r},{!r},{!r},{!r})' for feed in feeds: self.db.executeDML(sql.format(table, feed.fromFeedId, feed.title, feed.link, feed.pubDate)) Cache.update(feed) #update cache when fetched new feed