add cache support, not finished yet