Some headers need to include database.hh just because of cache_temperature. Move it into its own header so these includes can be removed.