implemented heap cache