flush cache when switching pages