'Sets caching headers based on whether or not the asset is locked.'

def set_caching_headers(self, content, response):

    is_locked = getattr(content, 'locked', False)
    cache_ttl = CourseAssetCacheTtlConfig.get_cache_ttl()
    if ((cache_ttl > 0) and (not is_locked)):
        if newrelic:
            newrelic.agent.add_custom_parameter('contentserver.cacheable', True)
        response['Expires'] = StaticContentServer.get_expiration_value(datetime.datetime.utcnow(), cache_ttl)
        response['Cache-Control'] = 'public,    max-age={ttl},    s-maxage={ttl}'.format(ttl=cache_ttl)
    elif is_locked:
        if newrelic:
            newrelic.agent.add_custom_parameter('contentserver.cacheable', False)
        response['Cache-Control'] = 'private,    no-cache,    no-store'
    response['Last-Modified'] = content.last_modified_at.strftime(HTTP_DATE_FORMAT)
    force_header_for_response(response, 'Vary', 'Origin')
