cache: move hash computation into the parsing loop
(cherry picked from commit bbfb1edd70e15241d852d82eb7e1c1049a01b886)