add cache and rebuild API