Caching the samples first.