http_cache.py 文件源码

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

项目:oadoi 作者: Impactstory 项目源码 文件源码
def set_cache_entry(url, content, metadata):
    if sys.getsizeof(content) > MAX_PAYLOAD_SIZE_BYTES:
        logger.info(u"Not caching {} because payload is too large: {}".format(
            url, sys.getsizeof(content)))
        return
    hash_key = _build_hash_key(url)
    # logger.info(u"*** {} {}".format(url, hash_key))

    k = boto.s3.key.Key(requests_cache_bucket)
    k.key = hash_key
    k.set_contents_from_string(content)

    if metadata:
        k.set_remote_metadata(metadata, {}, True)

    # remote_key = requests_cache_bucket.get_key(hash_key)
    # logger.info(u"metadata: {}".format(remote_key.metadata))

    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号