add cache to sample