Cache state variables before entering packrat mode