create CachingIterator class