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
评论列表
文章目录