def METHOD_NAME(case_id, attachment_id, is_image=False):
    cache_key = f"{case_id}_{attachment_id}"
    cobject = (CachedImage if is_image else CachedObject)(cache_key)
    if not cobject.is_cached():
        content = CaseAttachment.get_content(case_id, attachment_id)
        stream = BytesIO(content.content_body)
        metadata = {'content_type': content.content_type}
        cobject.cache_put(stream, metadata)
    return cobject