Yelp/casper

Refactor cache_entry handling in cacheability_info map

garyjlin opened this issue · 0 comments

Right now we copy each key to a new table, which forces you to add a new line every time you add a config option. We should simply return the entire cache_entry, ie refactor:

cacheability_info = {
    is_cacheable = true,
    ttl = cache_entry['ttl'],
    pattern = cache_entry['pattern'],
    cache_name = cache_name,
    reason = nil,
    vary_headers_list = vary_headers_list,
    bulk_support = cache_entry['bulk_support'],
    id_identifier = cache_entry['id_identifier'],
    dont_cache_missing_ids = cache_entry['dont_cache_missing_ids'],
    enable_invalidation = cache_entry['enable_invalidation'],
    refresh_cache = false,
    num_buckets = cache_entry['buckets'],
}

into:

cacheability_info = {
    is_cacheable = true,
    cache_entry = cache_entry,
    cache_name = cache_name,
    reason = nil,
    vary_headers_list = vary_headers_list,
    refresh_cache = false,
}