build rebuild cache function