zmirror.py 文件源码

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

项目:zmirror 作者: aploium 项目源码 文件源码
def update_content_in_local_cache(url, content, method='GET'):
    """?? local_cache ??????, ??content
    ?stream?????"""
    if local_cache_enable and method == 'GET' and cache.is_cached(url):
        info_dict = cache.get_info(url)
        resp = cache.get_obj(url)
        resp.set_data(content)

        # ???????????content?, without_content ????true
        # ?????????, ???content????, ????????
        # ?stream???, ??????http?, ???????, ????????????????
        # ?????????????????????, ???????????????
        info_dict['without_content'] = False

        if verbose_level >= 4: dbgprint('LocalCache_UpdateCache', url, content[:30], len(content))
        cache.put_obj(
            url,
            resp,
            obj_size=len(content),
            expires=get_expire_from_mime(parse.mime),
            last_modified=info_dict.get('last_modified'),
            info_dict=info_dict,
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号