[misc] Improve cache initialization