__init__.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:SuperOcto 作者: mcecchi 项目源码 文件源码
def _get_channel_data_from_cache(self, key, config):
        """Fetch channel feed from cache."""

        channel_path = self._get_channel_cache_path(key)

        if os.path.exists(channel_path):
            if "ttl" in config and isinstance(config["ttl"], int):
                ttl = config["ttl"]
            else:
                ttl = self._settings.get_int(["ttl"])

            ttl *= 60
            now = time.time()
            if os.stat(channel_path).st_mtime + ttl > now:
                d = feedparser.parse(channel_path)
                self._logger.debug(u"Loaded channel {} from cache at {}".format(key, channel_path))
                return d

        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号