Cache matrix_ids

We need to return matrix_ids in the API along with builds data. This
commit starts caching matrix_ids as a postgresql array, which should
help with performance, as we will no longer need to load jobs when
returning builds list.