Cache entity id values to improve performance.