def update_cache_bykey(cache_list, new_list, key='id'):
    """
    Given a cache list of dicts, update the cache with a 2nd list of dicts by a specific key in the dict.
    :param cache_list: List of dicts
    :param new_list: New list of dicts to update by
    :param key: Optional, key to use as the identifier to update new entries with
    :return: Updated list of dicts
    """
    # create a cache dict keyed by id.
    cache_bykey = {entry[key]: entry for entry in cache_list if entry.get(key)}
    # create a new dict keyed by id.
    new_bykey = {entry[key]: entry for entry in new_list if entry.get(key)}
    # combine and update cache into a 3rd dict
    combined_bykey = {**cache_bykey, **new_bykey}
    # return a list of the updated dict.
    return [value for key, value in combined_bykey.items()]