def set(self, obj_type, db_rendered_objs, req_fields, include_backrefs_children):
    result_obj_dicts = []
    if req_fields:
        result_fields = (set(req_fields) | set(['fq_name', 'uuid', 'parent_type', 'parent_uuid']))
    for (obj_uuid, render_info) in list(db_rendered_objs.items()):
        id_perms_ts = render_info.get('id_perms_ts', 0)
        row_latest_ts = render_info.get('row_latest_ts', 0)
        cached_obj = self._cache.pop(obj_uuid, None)
        if (cached_obj is not None):
            cached_obj.update_obj_dict(render_info['obj_dict'])
            cached_obj.id_perms_ts = id_perms_ts
            if include_backrefs_children:
                cached_obj.row_latest_ts = row_latest_ts
        else:
            cached_obj = self.CachedObject(render_info['obj_dict'], id_perms_ts, row_latest_ts)
        if (len(self._cache) >= self.max_entries):
            if hasattr(self._cache, 'iterkeys'):
                key = next(iter(list(self._cache.iterkeys())))
            else:
                key = next(iter(list(self._cache.keys())))
            self.evict(obj_type, [key])
        self._cache[obj_uuid] = cached_obj
        if (obj_type in self._debug_obj_cache_types):
            self._log(('%s %s (%s) was set in cache with values: %s' % (obj_type.replace('_', ' ').title(), ':'.join(cached_obj.obj_dict['fq_name']), obj_uuid, pformat(cached_obj.obj_dict))))
        if req_fields:
            result_obj_dicts.append(cached_obj.get_filtered_copy(result_fields))
        else:
            result_obj_dicts.append(cached_obj.get_filtered_copy())
    return result_obj_dicts
def set(self, obj_type, db_rendered_objs, req_fields, include_backrefs_children):
    result_obj_dicts = []
    if req_fields:
        result_fields = (set(req_fields) | set(['fq_name', 'uuid', 'parent_type', 'parent_uuid']))
    for (obj_uuid, render_info) in list(db_rendered_objs.items()):
        id_perms_ts = render_info.get('id_perms_ts', 0)
        row_latest_ts = render_info.get('row_latest_ts', 0)
        cached_obj = self._cache.pop(obj_uuid, None)
        if (cached_obj is not None):
            cached_obj.update_obj_dict(render_info['obj_dict'])
            cached_obj.id_perms_ts = id_perms_ts
            if include_backrefs_children:
                cached_obj.row_latest_ts = row_latest_ts
        else:
            cached_obj = self.CachedObject(render_info['obj_dict'], id_perms_ts, row_latest_ts)
        if (len(self._cache) >= self.max_entries):
            if hasattr(self._cache, 'iterkeys'):
                key = next(iter(list(self._cache.iterkeys())))
            else:
                key = next(iter(list(self._cache.keys())))
            self.evict(obj_type, [key])
        self._cache[obj_uuid] = cached_obj
        if (obj_type in self._debug_obj_cache_types):
            self._log(('%s %s (%s) was set in cache with values: %s' % (obj_type.replace('_', ' ').title(), ':'.join(cached_obj.obj_dict['fq_name']), obj_uuid, pformat(cached_obj.obj_dict))))
        if req_fields:
            result_obj_dicts.append(cached_obj.get_filtered_copy(result_fields))
        else:
            result_obj_dicts.append(cached_obj.get_filtered_copy())
    return result_obj_dicts