move cache into own class